MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Gurus, what is the problem with this code ?

    Scheduled Pinned Locked Moved Development
    10 Posts 4 Posters 2.5k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Mykle1M Offline
      Mykle1 Project Sponsor Module Developer
      last edited by

      I can’t read it when it’s not in a code block? :-0)

      Create a working config
      How to add modules

      1 Reply Last reply Reply Quote 0
      • rsellmerR Offline
        rsellmer
        last edited by

        Ok … I am so sorry about that. It was not easy to understand.
        Let me try to explain … I need call a function which is declared into the config.js. However, this is impossible. Nothing appeared on the screen. I did not find any example using a function call. Is it clear ?

        1 Reply Last reply Reply Quote 0
        • rsellmerR Offline
          rsellmer
          last edited by

          /* Magic Mirror Config Sample
           *
           * By Michael Teeuw http://michaelteeuw.nl
           * MIT Licensed.
           *
           * For more information how you can configurate this file
           * See https://github.com/MichMich/MagicMirror#configuration
           *
           */
          
          var full  = "";
          
          function LoadData() {
          
          full = "Hello";
          
          }
          
          $( document ).ready(function() {
          	LoadData();
          }); 
          
          var config = {
          	address: "localhost", 
                  port: 8080,
          	ipWhitelist: ["192.168.1.9"],
          	language: "en",
          	timeFormat: 24,
          	units: "metric",
          	zoom: 0.85,
          	
                  modules: [
          
          		{
          		module: "helloworld",
          		position: "center",
          		config: {
          			text: full
          		}
          		},
          
          	]
          
          };
          
          /*************** DO NOT EDIT THE LINE BELOW ***************/
          if (typeof module !== "undefined") {module.exports = config;}
          
          ? 1 Reply Last reply Reply Quote 0
          • ? Offline
            A Former User @rsellmer
            last edited by

            @rsellmer
            As I’ve written in your other post, jQuery is not included as a default. You did a try to use jQuery($(document).ready())

            rsellmerR 1 Reply Last reply Reply Quote 0
            • rsellmerR Offline
              rsellmer @Guest
              last edited by

              @sean Tks again … I am newb with MM, so I think that it is not possible to create a function in the config.js … I think that this will not work. because the next step I will need to call an api from config.js to get some data from mysql.
              In my test using a config.js out the MM system, I could call the api, but I think that this is not possible in the MM. Am I right ? Tks

              ? 2 Replies Last reply Reply Quote 0
              • ? Offline
                A Former User @rsellmer
                last edited by A Former User

                @rsellmer
                config.js is not for your custom job. leave it.
                When you want to do something your own, create module.
                Read the manual.

                • https://github.com/MichMich/MagicMirror/blob/master/modules/README.md

                And see how other modules work;

                • https://github.com/MichMich/MagicMirror/wiki/3rd-party-modules

                You can start by modifying any simple module as your wish.

                1 Reply Last reply Reply Quote 1
                • ? Offline
                  A Former User @rsellmer
                  last edited by A Former User

                  @rsellmer
                  one more thing;
                  config.js is validated when MM is booted up, not rendered. maybe you can put some codes in config.js but that would not be working as your expectation.

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  Enjoying MagicMirror? Please consider a donation!
                  MagicMirror created by Michael Teeuw.
                  Forum managed by Sam, technical setup by Karsten.
                  This forum is using NodeBB as its core | Contributors
                  Contact | Privacy Policy