• 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.

Calling a general function

Scheduled Pinned Locked Moved Development
3 Posts 3 Posters 1.0k 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.
  • R Offline
    rsellmer
    last edited by yawns Aug 5, 2018, 2:16 PM Aug 5, 2018, 7:20 AM

    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,
    	},
    
    J ? 2 Replies Last reply Aug 5, 2018, 2:15 PM Reply Quote 0
    • J Offline
      justjim1220 Module Developer @rsellmer
      last edited by Aug 5, 2018, 2:15 PM

      @rsellmer said in Calling a general function:

      afternoonEndTime: 17,

      try removing the comma at the end of this line.

      "Life's Too Short To Dance With Ugly People"
      Jim Hallock - 1995

      1 Reply Last reply Reply Quote 0
      • ? Offline
        A Former User @rsellmer
        last edited by Aug 5, 2018, 5:39 PM

        @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.

        1 Reply Last reply Reply Quote 1
        • 1 / 1
        1 / 1
        • First post
          1/3
          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