Methods
# inner isLoaded() → {boolean}
Returns true if the custom widget has been loaded, otherwise false.
boolean
# inner setLoadedCallback(loadedCallback)
Sets callback functions to be executed after a custom widget has been loaded.
Parameters:
Name | Type | Description |
---|---|---|
loadedCallback |
module:RMP_CustomWidget~loadedCallback | Callback function to execute |
Example
// Custom Widget contains two widgets: input_widget, switch_widget
// Custom Widget ID: custom_widget
// The callbacks will be called in this order: callback, another_callback, finalCallback
function callback() {
// ...
console.log('Log 1');
}
function another_callback() {
// do something with the CW's widgets
custom_widget.input_widget.setLabel("New Input Label");
custom_widget.switch_widget.setValue("New Switch Label");
console.log('Log 2');
}
// you can also grab the CW's widget IDs from the callback parameters
function finalCallback({
input_widget,
switch_widget
}) {
// do something with the CW's widgets
input_widget.setValue("New value");
switch_widget.setValue("false");
console.log('Log 3');
}
custom_widget.setLoadedCallback(callback);
custom_widget.setLoadedCallback(another_callback);
custom_widget.setLoadedCallback(finalCallback);
Type Definitions
# loadedCallback(customWidgetAPI)
Parameters:
Name | Type | Description |
---|---|---|
customWidgetAPI |
object | The callback accepts the API object of the custom widget. You can grab the custom widget's children like in the finalCallback in the example. |