Commit 3fb1ed46 by Sixong.Zhu

u

parent 887ff12a
Showing with 7 additions and 2 deletions
...@@ -285,7 +285,7 @@ export class Xim { ...@@ -285,7 +285,7 @@ export class Xim {
kind: string, kind: string,
listener: ChatNotifyListener listener: ChatNotifyListener
): this; ): this;
public on(event: "chat", listener: ChatNotifyListener): this;
public on(event: "chat_notify", listener: ChatNotifyListener): this; public on(event: "chat_notify", listener: ChatNotifyListener): this;
public on(event: "status", listener: StatusChangeListener): this; public on(event: "status", listener: StatusChangeListener): this;
public on(...args: any[]): this { public on(...args: any[]): this {
...@@ -306,7 +306,7 @@ export class Xim { ...@@ -306,7 +306,7 @@ export class Xim {
kind: string, kind: string,
listener: ChatNotifyListener listener: ChatNotifyListener
): this; ): this;
public off(event: "chat", listener: ChatNotifyListener): this;
public off(event: "chat_notify", listener: ChatNotifyListener): this; public off(event: "chat_notify", listener: ChatNotifyListener): this;
public off(event: "status", listener: StatusChangeListener): this; public off(event: "status", listener: StatusChangeListener): this;
public off(...args: any[]): this { public off(...args: any[]): this {
...@@ -430,6 +430,11 @@ export class Xim { ...@@ -430,6 +430,11 @@ export class Xim {
this.on("msg", action); this.on("msg", action);
vue.$once("hook:beforeDestroy", () => this.off("msg", action)); vue.$once("hook:beforeDestroy", () => this.off("msg", action));
} }
public registerOnChatChanged(vue: Vue, action: () => void) {
this.on("chat", action);
vue.$once("hook:beforeDestroy", () => this.off("chat", action));
}
} }
const ximInstance = new Xim(); const ximInstance = new Xim();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment