Read the statement by Michael Teeuw here.
Except a module in getModules()
-
I have a button module, which throws notification when a button is pressed. What I want is, it blacks out the whole screen except “Hello World”. So I will be using
**var i,modules = MM.getModule();
for(i=0;i -
@yours.mukul exceptModule doens’t work with strings, instead it needs a module instance. What error do you get? The example is from the developers guide
MM.getModules().exceptModule(helloworld).enumerate(function(module) { module.hide(1000, function() { //Module hidden. }); });
-
This post is deleted! -
socketNotificationReceived: function(notification, payload) { var i,modules = MM.getModules(); if (notification === "BUTTON_PRESSED"){ this.sendNotification(notification, payload); for(i=0; imodules.length; i+=1){ if(modules[i].hidden == true){ modules[i].show(0); } else if(modules[i].hidden == false) { modules[i].hide(0); } } }
I want to show/hide all the modules except the **hello world ** module. Please help me out with that.
Note: I was unable to write less than sign in the for loop while writing this reply, I think its a bug, in this forum, whenever I write less than, all the text after it is is ignored.
-
@yours.mukul i can’t test it right now. what error do you get?
try the example from the docs
socketNotificationReceived: function(notification, payload) { if (notification === "BUTTON_PRESSED"){ MM.getModules().exceptModule(helloworld).enumerate(function(module) { module.hide(1000, function() { //Module hidden. }); }); } }
-
@strawberry-3.141 how to iterate over the modules array ?
I want to show/hide all modules except the “helloworld”. -
MM.getModules().enumerate((module)=>{ if(module.name !== "helloworld") { module.hide() } })
This is written by hand, so there might be error, but you can understand how it goes.
-
@yours.mukul enumerate will iterate over the array and will execute the function you specify for each module in the array
-
@strawberry-3.141 Well your code didn’t hide any of modules
-
@yours.mukul do you get any errors?