Global
Global functions and objects available in EasyBuilder X Custom Model scripts.
Global Objects
console
An instance of Console in the global scope. Messages appear in the cMT Inspector debugging console.
console.log("Hello world!");globalThis
globalThis provides access to the JavaScript global object as defined in ECMA-262. Custom Widgets in the same EasyBuilder X View share a JavaScript context and global object. A View can be a Screen or Window. Each Widget has its own this interface and Property values.
Use globalThis when explicitly accessing global APIs in new scripts.
| Property | Type | Description |
|---|---|---|
globalThis.memoryStorage | MemoryStorage | The unique MemoryStorage instance. |
globalThis.memoryStorage.setItem("currentFont", "Helvetica");net
The net namespace is available as a global object. Provides classes and functions for network operations (cURL-based web requests).
var curl = new net.Curl.Easy();Functions
cancelAnimationFrame(requestID)
Cancels an animation frame request previously scheduled with requestAnimationFrame(). See MDN web docs.
Parameters
| Name | Type | Description |
|---|---|---|
requestID | Object | The ID returned by the corresponding requestAnimationFrame() call. |
clearInterval(intervalID)
Cancels a timed, repeating action previously established by setInterval(). See MDN web docs.
Parameters
| Name | Type | Description |
|---|---|---|
intervalID | Object | The ID returned by the corresponding setInterval() call. |
clearTimeout(timeoutID)
Cancels a timeout previously established by setTimeout(). See MDN web docs.
Parameters
| Name | Type | Description |
|---|---|---|
timeoutID | Object | The ID returned by the corresponding setTimeout() call. |
requestAnimationFrame(callback)
Tells the system to call a specified function to update an animation before the next repaint. See MDN web docs.
Parameters
| Name | Type | Description |
|---|---|---|
callback | Function | The function to call before the next repaint. Receives one argument: a 64-bit integer timestamp (milliseconds since time origin). |
Returns: Object — A request ID that can be passed to cancelAnimationFrame().
require(id)
Imports a module. Supports relative paths (e.g. ./, ./foo, ../foo).
Parameters
| Name | Type | Description |
|---|---|---|
id | String | Module name or path. |
Returns: * — The exported module content.
Example
const myModule = require('/myModule.js');setInterval(func, delay)
Repeatedly calls a function with a fixed time delay between each call. See MDN web docs.
Parameters
| Name | Type | Description |
|---|---|---|
func | Function | The function to execute every delay milliseconds. |
delay | Number | The time in milliseconds between executions. |
Returns: Object — An interval ID that can be passed to clearInterval().
setTimeout(func, delay)
Executes a function once after the timer expires. See MDN web docs.
Parameters
| Name | Type | Description |
|---|---|---|
func | Function | The function to execute after the timer expires. |
delay | Number | Time in milliseconds to wait. Defaults to 0. |
Returns: Object — A timeout ID that can be passed to clearTimeout().