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

module.js

Scheduled Pinned Locked Moved Bug Hunt
7 Posts 2 Posters 506 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 Sep 29, 2020, 12:25 PM

    This post is deleted!
    S 1 Reply Last reply Sep 29, 2020, 12:32 PM Reply Quote 0
    • S Away
      sdetweil @Guest
      last edited by sdetweil Sep 29, 2020, 12:34 PM Sep 29, 2020, 12:32 PM

      @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 Sep 29, 2020, 12:37 PM Sep 29, 2020, 12:35 PM

        This post is deleted!
        S 1 Reply Last reply Sep 29, 2020, 12:40 PM Reply Quote 0
        • S Away
          sdetweil @Guest
          last edited by Sep 29, 2020, 12:40 PM

          @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 Sep 29, 2020, 12:54 PM

            This post is deleted!
            S 1 Reply Last reply Sep 29, 2020, 12:59 PM Reply Quote 0
            • S Away
              sdetweil @Guest
              last edited by sdetweil Sep 29, 2020, 1:00 PM Sep 29, 2020, 12:59 PM

              @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 Sep 29, 2020, 2:56 PM Sep 29, 2020, 2:42 PM

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • 1 / 1
                1 / 1
                • First post
                  1/7
                  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