• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.2k 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.
  • M Offline
    Mykle1 Project Sponsor Module Developer
    last edited by Aug 5, 2018, 9:43 PM

    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
    • R Offline
      rsellmer
      last edited by Aug 5, 2018, 11:12 PM

      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
      • R Offline
        rsellmer
        last edited by Aug 5, 2018, 11:31 PM

        /* 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 Aug 6, 2018, 6:24 AM Reply Quote 0
        • ? Offline
          A Former User @rsellmer
          last edited by Aug 6, 2018, 6:24 AM

          @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())

          R 1 Reply Last reply Aug 6, 2018, 7:13 AM Reply Quote 0
          • R Offline
            rsellmer @Guest
            last edited by Aug 6, 2018, 7:13 AM

            @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 Aug 6, 2018, 7:18 AM Reply Quote 0
            • ? Offline
              A Former User @rsellmer
              last edited by A Former User Aug 6, 2018, 7:19 AM Aug 6, 2018, 7:18 AM

              @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 Aug 6, 2018, 8:51 AM Aug 6, 2018, 7:21 AM

                @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
                1 / 1
                • First post
                  8/10
                  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