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.
    • rsellmerR Offline
      rsellmer
      last edited by yawns

      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,
      	},
      
      justjim1220J ? 2 Replies Last reply Reply Quote 0
      • justjim1220J Offline
        justjim1220 Module Developer @rsellmer
        last edited by

        @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

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