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

One-line switch to enable / disable modules

Scheduled Pinned Locked Moved Feature Requests
14 Posts 7 Posters 7.1k Views 6 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.
  • S Offline
    Sebi76
    last edited by Sebi76 Dec 24, 2018, 9:11 PM Dec 24, 2018, 9:09 PM

    This post is deleted!
    1 Reply Last reply Reply Quote 0
    • ? Offline
      A Former User
      last edited by A Former User Jan 28, 2019, 1:54 PM Jan 28, 2019, 1:53 PM

      @rudibarani @michael5r

      Here is my version. No need to list all modules.

      const pre_disabled = {
        "UNLISTED": true, // default value for unlisted other modules.
        "alert":false,
        "clock": false,
        "MMM-Remote-Control":false,
       }
      
      var DISABLED = new Proxy(pre_disabled, {
        get (receiver, name) {
          return name in receiver ? receiver[name] : receiver["UNLISTED"]
        }
      })
      
      M 1 Reply Last reply Jan 29, 2019, 8:22 PM Reply Quote 1
      • M Offline
        michael5r Module Developer @Guest
        last edited by Jan 29, 2019, 8:22 PM

        @sean said in One-line switch to enable / disable modules:

        @rudibarani @michael5r

        Here is my version. No need to list all modules.

        const pre_disabled = {
          "UNLISTED": true, // default value for unlisted other modules.
          "alert":false,
          "clock": false,
          "MMM-Remote-Control":false,
         }
        
        var DISABLED = new Proxy(pre_disabled, {
          get (receiver, name) {
            return name in receiver ? receiver[name] : receiver["UNLISTED"]
          }
        })
        

        Lovely :thumbs_up_light_skin_tone:

        1 Reply Last reply Reply Quote 0
        • J Offline
          jg3 @strawberry 3.141
          last edited by Apr 5, 2020, 1:52 PM

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