diff --git a/intercomjs/intercom-tests.ts b/intercomjs/intercom-tests.ts index be25ba7db..89729ca28 100644 --- a/intercomjs/intercom-tests.ts +++ b/intercomjs/intercom-tests.ts @@ -17,4 +17,6 @@ function test_intercom_static() { console.log(onceListenerInvokedTimes === 1); instance.emit("eventWithoutAMessage"); + + instance.off("test", detect); } diff --git a/intercomjs/intercom.d.ts b/intercomjs/intercom.d.ts index c149c827d..888f587a5 100644 --- a/intercomjs/intercom.d.ts +++ b/intercomjs/intercom.d.ts @@ -17,6 +17,12 @@ declare module intercom { * @param fn The listener method to invoke. */ on(name: string, fn: Function): void; + /** + * Remove a registered event listener + * @param name The string event listener name. + * @param fn The listener method to remove. + */ + off(name: string, fn: Function): void; /** * Given a unique key to represent the function, fn will be invoked in only one window. The ttl argument represents the number of seconds before the function can be called again. * @param key The unique function identifier key