MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

Calling a general function



  • Hi guys, this is my first project using MM and I am having an issue to call a simple function.
    I need only modify the variable using a function and it is not working. Maybe because I put the function in the wrong place. Please, help me:

    /* global Log, Module, moment */
    
    /* Magic Mirror
     * Module: Compliments
     *
     * By Michael Teeuw http://michaelteeuw.nl
     * MIT Licensed.
     */
    
    var full_text = "Have a good stay";
    function LoadData() {
    
    	  full_text = "Welcome " + "Renato" + ". Have a great stay !";
    }
    
    $( document ).ready(function() {
    	
    		LoadData();
    
      }); 
    
    Module.register("compliments", {
    	// Module config defaults.
    	defaults: {
    		compliments: {
    			anytime:[
    				full_text,
    			],
    		},
    		updateInterval: 72000000,
    		remoteFile: null,
    		fadeSpeed: 4000,
    		morningStartTime: 3,
    		morningEndTime: 12,
    		afternoonStartTime: 12,
    		afternoonEndTime: 17,
    	},
    

  • Module Developer

    @rsellmer said in Calling a general function:

    afternoonEndTime: 17,

    try removing the comma at the end of this line.


  • Module Developer

    @rsellmer I’m not sure, but you seem to use jQuery. but jQuery is not included by default. You should include jQuery into your module.


Log in to reply