Read the statement by Michael Teeuw here.
Except a module in getModules()
-
@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)
,someModule
should 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