0.0.1 • Published 2 years ago
@blockprotocol/action v0.0.1
Block Protocol – Action Module
This package implements the Block Protocol Action module for blocks and embedding applications.
To get started:
yarn add @blockprotocol/actionornpm install @blockprotocol/action- Follow the instructions to use the action module as a block or an embedding application
Blocks
To create a ActionBlockHandler, pass the constructor:
- An
elementin the block callbacksto respond to messages from the embedder- You should register a callback for the
updateActionmessage, which allows embedding application to set new labels for block actions.
- You should register a callback for the
To tell the embedding application what elements will dispatch actions, call the availableActions function.
Send this message again if the available actions change.
To send an action message, you call the action function.
Embedding applications
To create a ActionEmbedderHandler, pass the constructor:
- An
elementwrapping the block callbacksto respond to messages from the block- you should register callbacks for
availableActionsto do something with the actions the block advises are possible actionto process individual action reports
- you should register callbacks for
To update the label in an action, call updateAction. The block should respond with the updated availableActions.