Skip to content

springboardDocs


springboard / module_api / ModuleAPI

Class: ModuleAPI

The API provided in the callback when calling registerModule. The ModuleAPI is the entrypoint in the framework for everything pertaining to creating a module.

Properties

statesAPI

readonly statesAPI: StatesAPI

Create shared and persistent pieces of state, scoped to this specific module.

Methods

createAction()

createAction<Options, Args, ReturnValue>(actionName: string, options: Options, cb: ActionCallback<Args, ReturnValue>): ActionCallback<Args, ReturnValue>

Create an action to be run on the Maestro device. If the produced action is called from the Maestro device, the framework just calls the provided callback. If it is called from another device, the framework calls the action via RPC to the Maestro device. In most cases, any main logic or calls to shared state changes should be done in an action.


registerRoute()

registerRoute(routePath: string, options: RegisterRouteOptions, component: ElementType<RouteComponentProps, keyof IntrinsicElements>): void

Register a route with the application's React router. The route will be accessible from the browser at myserver.com/modules/(module_id)/(route). The route will also be registered to the application's navigation bar.