Make widget configurable

Currently, there are no configuration options for the Demo widget.

To change that, in the widget folder open the config.json file in a text editor. Add some JSON-structured text so that you can pass the config to your widget:


Alter the HTML template to use the config that you read from your config file.

    <div>I am a demo widget.</div>
    <div>This is configurable.[${config.configText}]</div>

Now, the Demo widget looks like the following:

Make widget configurable

The config.configText marker in the template is automatically substituted with the values in the config.json file.

You can use this.config.configText in your Widget.js to access the config value.