# 调用多次的监听器 onAppEvent

● 接口说明
调用多次的监听器

● Typescript 类型参考

type  appEventChannel = string

type AppEventArg ={
    data?: any,//消息所携带的数据
    actionTimeout?: number //如果消息是触发一个动作,该动作的超时时长,接受消息的对象到了规定的时间取消该动作。
}
zwexplorer.__appEvent.onAppEvent(data: appEventChannel, callback?: (res: AppEventArg)=>void): Promise<AppEventArg>

● 返回数据

参数 类型 必然存在 说明
res.data any 消息所携带的数据
res.actionTimeout number 如果消息是触发一个动作,该动作的超时时长,接受消息的对象到了规定的时间取消该动作

● 示例

const param = { data: "tranel1", actionTimeout: 200 };
zwexplorer["__appEvent"]["onAppEvent"](param, (res) => {});

# onceAppEvent 仅仅调用一次的监听器

● 接口说明
仅仅调用一次的监听器

● Typescript 类型参考

type  appEventChannel =string

type AppEventArg ={
    data?: any,//消息所携带的数据
    actionTimeout?: number //如果消息是触发一个动作,该动作的超时时长,接受消息的对象到了规定的时间取消该动作。
}
zwexplorer.__appEvent.onceAppEvent(data: appEventChannel, callback?: (res: AppEventArg)=>void): Promise<AppEventArg>

● 返回数据

参数 类型 必然存在 说明
res.data any 消息所携带的数据
res.actionTimeout number 如果消息是触发一个动作,该动作的超时时长,接受消息的对象到了规定的时间取消该动作

Buffer ● 示例

const param = { data: "tranel1", actionTimeout: 200 };
zwexplorer["__appEvent"]["onceAppEvent"](param, (res) => {});

# once 仅仅调用一次的监听器

● 接口说明
仅仅调用一次的监听器

● Typescript 类型参考

type  appEventChannel =string

type AppEventArg ={
    data?: any,//消息所携带的数据
    actionTimeout?: number //如果消息是触发一个动作,该动作的超时时长,接受消息的对象到了规定的时间取消该动作。
}
zwexplorer.__appEvent.once(data: appEventChannel, callback?: (res: AppEventArg)=>void): Promise<AppEventArg>

● 返回数据

参数 类型 必然存在 说明
res.data any 消息所携带的数据
res.actionTimeout number 如果消息是触发一个动作,该动作的超时时长,接受消息的对象到了规定的时间取消该动作

Buffer ● 示例

const param = { data: "tranel1", actionTimeout: 200 };
zwexplorer["__appEvent"]["once"](param, (res) => {});

# removeListener 移除事件监听器

● 接口说明
移除事件监听器

● Typescript 类型参考

type  appEventChannel =string

type AppEventArg ={
    data?: any,//消息所携带的数据
    actionTimeout?: number //如果消息是触发一个动作,该动作的超时时长,接受消息的对象到了规定的时间取消该动作。
}
zwexplorer.__appEvent.removeListener(data: appEventChannel, callback?: (res: AppEventArg)=>void): Promise<AppEventArg>

● 返回数据

参数 类型 必然存在 说明
res.data any 消息所携带的数据
res.actionTimeout number 如果消息是触发一个动作,该动作的超时时长,接受消息的对象到了规定的时间取消该动作

● 示例

const param = { data: "tranel1", actionTimeout: 200 };
zwexplorer["__appEvent"]["removeListener"](param, (res) => {});

# 移除所有同名的事件监听 removeAllListeners

● 接口说明

移除所有同名的事件监听

● Typescript 类型参考

type  appEventChannel =string

type AppEventArg ={
    data?: any,//消息所携带的数据
    actionTimeout?: number //如果消息是触发一个动作,该动作的超时时长,接受消息的对象到了规定的时间取消该动作。
}
zwexplorer.__appEvent.removeAllListeners(data: appEventChannel)

● 返回数据

参数 类型 必然存在 说明
res.data any 消息所携带的数据
res.actionTimeout number 如果消息是触发一个动作,该动作的超时时长,接受消息的对象到了规定的时间取消该动作

Buffer ● 示例

const param = { data: "tranel1", actionTimeout: 200 };
zwexplorer["__appEvent"]["removeAllListeners"](param);

# 消息发送 sendAppEvent

● 接口说明

消息发送

● Typescript 类型参考

type  appEventChannel =string

type AppEventArg ={
    data?: any,//消息所携带的数据
    actionTimeout?: number //如果消息是触发一个动作,该动作的超时时长,接受消息的对象到了规定的时间取消该动作。
}
zwexplorer.__appEvent.removeAllListeners(data: appEventChannel,appEventArg:AppEventArg, callback?: (res: { code: number; msg?: string; data?: any })=>void): Promise<res>

● 返回数据

参数 类型 必然存在 说明
res.code number 返回码
res.msg string 提示消息
res.data any 发送失败时, 返回抛出的异常

Buffer ● 示例

const str = "xxx";

const param = {
  data: "tranel1",
  actionTimeout: 200,
};

zwexplorer["__appEvent"]["removeAllListeners"](str, param, (res) => {});