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.

    module.js

    Scheduled Pinned Locked Moved Bug Hunt
    7 Posts 2 Posters 629 Views 1 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.
    • ? Offline
      A Former User
      last edited by

      This post is deleted!
      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @Guest
        last edited by sdetweil

        @hango no… the MM functions locate modules

        then u have the module object and call hide on it
        from my SleepWake module

        MM.getModules().enumerate((module) => {
        				// if the module is already hidden
        				if(module.hidden==true)
        					// save it for wake up
        					{self.previously_hidden.push(module.identifier);}
        				else
        					// hide this module
        					{module.hide(1000);}
        			});
        

        https://docs.magicmirror.builders/development/helper-methods.html#module-selection

        Sam

        How to add modules

        learning how to use browser developers window for css changes

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

          This post is deleted!
          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @Guest
            last edited by

            @hango from main.js

            var showModule = function (module, speed, callback, options) {
            var hideModule = function (module, speed, callback, options) {
            

            Sam

            How to add modules

            learning how to use browser developers window for css changes

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

              This post is deleted!
              S 1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @Guest
                last edited by sdetweil

                @hango before the call to hideModule
                there is a variable self set
                self is used to avoid the ambiguity of ‘this’, as inside callbacks ‘this’ can point to the caller, NOT the context where it was intended.

                	var self = this;     < ----- self is initialized to the current 'this' context
                	MM.hideModule(
                		self,              < -------------- should be 'this' ?
                		speed,
                

                so its the same
                and in the call there is a required function (the callback), in this case created inline

                		function () {
                			self.suspend();   // < --- make sure to use the right module context when this function is called
                                                                  // the compiler remembers that self was defined above 
                			callback();         // call the routine defined as callback
                		},
                

                Sam

                How to add modules

                learning how to use browser developers window for css changes

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

                  This post is deleted!
                  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