Ex09: New Viewport adapter
In this example we create a new viewport adapter and a dapplet for it.
Here is the initial code for this example: ex09-new-viewport-adapter-exercise.
Our template has an adapter that in structure is similar to the adapter in the previous exercise.
When you create an adapter don't forget to set contextIds
in /adapter/dapplet.json
. On these sites, the adapter will work:
- Implement communication between dapplets and pages in
/adapter/src/index.ts
:
- Implement the button markup with
image
andtooltip
in/adapter/src/button.ts
:
Define contextInsPoints
for the button
- Implement the popup markup with
text
,link
,img
andclosed
:
Define contextInsPoints
for the popup
- Change
dependencies
andcontextIds
in/dapplet-feature/dapplet.json
to new adapter:
- Add a valid adapter in
/dapplet-feature/src/index.ts
:
- Add
popup
with text, image and some link from the page inBODY
:
- On button click show the popup:
Here is the result: ex09-new-viewport-adapter-solution.
Run the dapplet:
In this example we run two servers concurrently. So you have to add two registry addresses to Dapplet extension in Development tab. Click here for instructions.