Read the statement by Michael Teeuw here.
Except a module in getModules()
-
var i,modules = MM.getModules().exceptModule(helloworld);
The above code throws error, while the below doesn’t work
var i,modules = MM.getModules().exceptModule(‘helloworld’); -
@yours.mukul can you give some context, like the whole module code or what you ate tryng to achieve?
-
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?
-
@yours.mukul
In.exceptModule(someModule),someModuleshould be an instance of module object. It means you should get the object first before enumerating.
Usually, you can get module object instance with notification. In other way, you should enumerate all modules first, filter them by name(or any other condition), after then you can use those objects for.exceptModule()as parameter.So I think you’d better examine other modules how they handle this. Not so difficult.
-
@strawberry-3.141 No there were no errors but I didn’t hide my modules
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login