API Namespace
- Source
Classes
Namespaces
- CONFIG
- CONTROLLER
- DEVICE
- FILESYSTEM
- INTERACTION
- MOTION
- RAPID
- RWS
- SIGNAL
- SIGNALMONITOR
- UAS
- VARIABLEMONITOR
- WEBDATAMONITOR
Methods
formatValue(value) → {any}
Asynchronous formatValue function
Parameters:
| Name | Type | Description |
|---|---|---|
value | any | The value to be formatted. |
- Source
Returns:
- Type:
- any
Example
API.formatValue("\"666\"");generateUUID() → {string}
Generates a UUIDs (Universally Unique Identifier)
- Source
Returns:
UUID
- Type:
- string
Example
let uuid = API.generateUUID()isTPU() → {boolean}
Returns true if running in TPU environment
- Source
Returns:
- Type:
- boolean
Example
let bInTPU = API.isTPU()isWebView() → {boolean}
Returns true if running in a webview environment
- Source
Returns:
- Type:
- boolean
Example
let bInWebView = API.isWebView()sleep(ms) → {Promise}
Asynchronous sleep function
Parameters:
| Name | Type | Description |
|---|---|---|
ms | number | Time in miliseconds |
- Source
Returns:
- Type:
- Promise
Example
await API.sleep(1000);waitForCondition(func, interval_ms, timeout_ms) → {Promise}
Wait for a condition to be true. It can be used together with Promise.race and API.timeout to wait for a condition with timeout
Parameters:
| Name | Type | Description |
|---|---|---|
func | function | Function containing the condition |
interval_ms | API. | Interval in miliseconds |
timeout_ms | API. | Timeout in miliseconds |
- Source
Returns:
- Type:
- Promise
Example
await API.waitForCondition(async ()=>{
const state= await API.CONTROLLER.getControllerState() === API.CONTROLLER.STATE.MotorsOn;
console.log(state);
return state;
}, {interval_ms: 100, timeout_ms: 10000});