Mura Scope
The Mura Scope provides a standard, concise syntax for interfacing with Mura objects (and their properties and events). Essentially, this is how you "talk" with Mura.
Code running inside of Mura will have the Mura Scope available as "$" or "mura."
If you are writing code that will run outside of the normal Mura event model, you can obtain an instance it from the application.serviceFactory
object.
$ = application.serviceFactory.getBean('$');
Then, you can initialize it with either an instance of an event object, a struct containing value pairs, or simply a siteID
string value.
$.init(event); $.init(myStruct); $.init(session.siteID);
If you init your Mura Scope instance with an event object or struct, be sure to include a siteID
attribute, if it is available.
event.setValue({siteID}); $.init(event); myStruct = { siteID='someSiteID' }; $.init(myStruct);
You can also use the following notation to initialize the Mura Scope in one line:
$ = application.serviceFactory.getBean('$').init('someSiteID');