UNPKG

miniapp-web-jsapi

Version:

JSAPI/View adapter for miniprogram running on the web

52 lines (51 loc) 1.15 kB
export interface ISendRpcOptions { operationType: string; requestData: any; gateway?: string; headers?: { [key: string]: string; }; success?(res: any): void; fail?(err: RpcError | any): void; complete?(): void; } export interface IRpcResponse { success: boolean; errorCode: string; errorMessage: string; memo?: string; traceId?: string; extendInfo?: { [key: string]: any; }; } export declare class RpcError extends Error { constructor(message?: string); resultStatus?: string; memo?: string; tips?: string; extraMessage?: string; traceId?: string; } export interface IRpcErrorHandler { /** * 通知失败 */ notifyFail: (err: RpcError | any) => void; /** * 重发 Rpc */ resend: VoidFunction; } export interface IRpcInterceptor { /** * Rpc 发送前调用 * * @returns true 则表示终止该 Rpc */ onBeforeSendRpc?(sendRpcOptions: ISendRpcOptions): boolean; /** * Rpc 发送异常时调用 */ onRpcError?(error: RpcError | any, handler: IRpcErrorHandler): void; }