First you need to install the Dapplet extension package to your project. Use npm for this:
Then create the manifest
Here set the title and icon and check if the other fields match your project.
As you can see
"dependencies" contain the name of our Twitter adapter:
"twitter-adapter.dapplet-base.eth". The last field specifies which version should be used.
/config directory with the following structure:
schema.json we specify the settings for the dapplet, which will be available in a browser through the extension.
default.json contains defaults for the schema for three environments: main, test and dev.
Finally, implement the dapplet’s
/src/index.ts according to the example:
Widgets are taken from the adapter's
and then used in the
attachConfig receives an object with context names as keys. The values of the object are functions which return a widget or an array of widgets.
attachConfig returns the object with
$(ctx, 'element_id') function,
which returns the Proxy of the widget by its id.
Widgets have states. The DEFAULT (case sensitive) state is used as initial.
It's possible to implement many states.
If the DEFAULT state is not presented, the initial state has to be specified explicitly.
We pass parameters of the widget described in the adapter into states.
Adapters provide a number of events for different contexts that dapplets can listen to.
They are used in the
attachConfig function near the insertion points: