| Function |
Description |
show(screen)
show(screen, layer) |
Shows the specified Screen. If layer is specified then screen appear at that layer, otherwise all layers are hidden and only the specified screen will appear. |
| hide(screen) |
Hides the screen if currently shown in any layer. |
| alert(message) |
Shows an alert screen with the specified message |
| repaint() |
Explicitly request a repaint of the moblet |
load(url)
load(url, persist)
load(url, persist, gatewayUrl) |
Loads the specified bytecode. Any existing state will be lost when calling this function. It is equivalent to exiting the current moblet and launching another. Any state available in the current Moblet will no longer be accessible to the moblet loaded with these functions. |
loadResource(url)
loadResource(url, persist)
loadResource(url, persist, priority)
loadResource(url, persist, priority, scaleW)
loadResource(url, persist, priority, scaleW, scaleH)
loadResource(url, async, persist, priority, scaleW, scaleH, async)
loadResource(url, async, persist, priority, scaleW, scaleH, async, onError) |
The script equivalent of the <resource> tag. For details on using this function, see loadResource on the Moblet Object |
| removeResource(url) |
remove a resource from the shared (in-memory) cache. For details on using this function, see removeResource on the Moblet Object |
| inflate(binary) |
If content that is downloaded is compressed this function will inflate the content. This is typically used on mojax resources which are downloaded compressed by default. |
| parseInt(string) |
Parse the string into an integer value according to the Javascript Rules |
| resolveUrl(url) |
Resolve (and normalize) the specified relative url to an absolute URL relative to the host:port/moblet_root |
| escape(string) |
This will escape any characters that are not supported within a URL. |
| escapeXML(string) |
This will escape any characters that are not supported within XML. |
| getElementById(id) |
Returns the first occurrence of a screen or screen child element with the given id.
 | Using dot notation such as Moblet.screen1.box will result in much better performance than using getElementById. | |
| reinstall(full) |
Triggers the moblet to reinstall itself. Warning: if full is true, this will flush all data in the Cache. |
| restart() |
Triggers the moblet to revert to its starting state. The effect is equivalent to reinstall(false). |
| upgradeMRE() |
Triggers a call to update the underlying MRE code |
| exit() |
Triggers the Moblet to exit. In doing so the onExit event handler is triggered on Moblet. |
| startTimeout(onTimeout, maxIdleTime) |
Starts an internal "idle" timer. If the moblet is idle for longer than the maxIdleTime then the onTimeout function is invoked |