ActionAPI interface
An interface representing action related APIs
Methods
execute<TData, TResult>(Action<TData>) | Executes an action whose action handler has been registered through |
on |
Registers a callback function to handle actions sent to the workload app iframe. This API is expected
to be called in |
Method Details
execute<TData, TResult>(Action<TData>)
Executes an action whose action handler has been registered through ActionAPI.onAction()
.
function execute<TData, TResult>(action: Action<TData>): Promise<ActionResult<TResult>>
Parameters
- action
-
Action<TData>
The action payload
Returns
Promise<ActionResult<TResult>>
The promise of action execution result
onAction((action: WorkloadAction<unknown>) => Promise<unknown>)
Registers a callback function to handle actions sent to the workload app iframe. This API is expected
to be called in initializeWorker()
or initializeUI()
.
function onAction(callback: (action: WorkloadAction<unknown>) => Promise<unknown>)
Parameters
- callback
-
(action: WorkloadAction<unknown>) => Promise<unknown>
The callback function