UNPKG

@j2inn/app

Version:

J2 Innovations core application framework

46 lines (45 loc) 1.35 kB
import type { Client } from 'haystack-nclient'; import type { AppRootStore } from './AppRootStore'; export interface onMessageArgs { /** * The name of the message to be handled. */ message: string; /** * The parameters for the message. */ params: Record<string, unknown>; /** * The client object used for making network calls. */ client: Client; /** * The application root store. */ appRootStore: AppRootStore; } /** * The app store. * * To access the application's store, use the `useAppStore()` hook. * * Please note, by default the app store exists beyond an application's view. */ export interface AppStore { /** * Called when a message is received. * * In order for this method to be called, an application must * declare its interested messages in {@link App.messages}. * * @param options.message The name of the message to be handled. * @param options.params The parameters for the message. * @param options.client The client object used for making network calls. * @param options.appRootStore The application root store. */ onMessage?({ message, params, client, appRootStore, }: onMessageArgs): void | Promise<void>; /** * Used as a workaround for empty interfaces. */ toString(): string; }