Custom Widget Parameters
Parameters allow you to send a list of keys and values to your custom widget.
One common use for parameters is to change how your code behaves. For example, you can point two widgets to the same link but configure each to exhibit different behaviors by using different parameters.
Each parameter has a unique key and a value. The key is used in your code to retrieve the parameter's value.
Note: You can specify up to 20 parameters.
Usage in code
Before reading this section, you should read the Custom Widget tutorial to understand how the widget code works.
In your code, the parameters are received in the onStart
function, for example:
window.TagoIO.onStart((widget) => {
const display = widget.display;
// Your code here — parameters are provided to the widget when it starts
});
For details on how to access specific parameter values inside your widget code, refer to the Custom Widget tutorial or the rest of the Custom Widget documentation.
Parameters are exposed as an array on display.parameters
. You can retrieve them like this:
window.TagoIO.onStart((widget) => {
const display = widget.display;
const parameters = display.parameters;
// Example: accessing the first two parameters by index
const parameter1 = parameters[0];
const parameter2 = parameters[1];
// Your code here — use the retrieved parameters as needed
});