message2call
Version:
Convert Send Message and on Message to asynchronous get and call style
29 lines (27 loc) • 662 B
TypeScript
export declare type ReadObj = Record<string, ((...args: unknown[]) => unknown) | string | number | object>
export declare interface Options {
/**
* required expose object
*/
exposeObj: Readonly<ReadObj>
/**
* send message function
*/
sendMessage: (data: unknown) => void
/**
* on call error hook
*/
onError?: (err: Error, path: string[], groupName: string | null) => viod
/**
* call timeout, 0 will be no timeout
*/
timeout?: number
/**
* whether the call fails to send the call stack
*/
isSendErrorStack?: boolean
/**
* convert call params
*/
onCallBeforeParams?: (rawArgs: unknown[]) => unknown[]
}