@open-condo/miniapp-utils
Version:
A set of helper functions / components / hooks used to build new condo apps fast
16 lines (13 loc) • 739 B
TypeScript
import { CondoBridge } from '@open-condo/bridge';
type ActionHandler = (actionId: string) => void;
type ActionHandlers = Partial<Record<string, ActionHandler>>;
/**
* Subscribes to host action events and routes them to local handlers.
*
* Use it with host-provided actions that return `actionsIds` after configuration.
* Those actions are rendered by the host in a platform-specific location
* (e.g., bottom action bar on web or top-bar icons on mobile). Pass a map of
* `{ [actionId]: handler }` so your miniapp can react to clicks on those actions.
*/
declare function useSetPageActionsHandlers(bridge: CondoBridge, handlers: ActionHandlers): void;
export { type ActionHandler, type ActionHandlers, useSetPageActionsHandlers };