From f4beede5f5fb613626bf3be06b3b6bfde70109ed Mon Sep 17 00:00:00 2001 From: Ika Date: Tue, 22 Sep 2015 11:59:51 +0400 Subject: [PATCH 1/2] Update cometd.d.ts added couple of functions: clearListeners, clearSubscriptions, configure, handshake, disconnect; --- cometd/cometd.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cometd/cometd.d.ts b/cometd/cometd.d.ts index 592c6c963..d5165584c 100644 --- a/cometd/cometd.d.ts +++ b/cometd/cometd.d.ts @@ -8,12 +8,23 @@ declare module CometD { var onListenerException: (exception: any, subscriptionHandle: any, isListener: boolean, message: string) => void; function init(options: ConfigurationOptions): void; + + function configure(config: ConfigurationOptions): void; function addListener(channel: string, listener: (message: any) => void): void; function removeListener(listener: (message: any) => void): void; + function clearListeners(): void; + + function clearSubscriptions(): void; + + function handshake(handshake_params: any): void; + function publish(channel: string, message: any): void; + + function disconnect(): void; + interface ConfigurationOptions { url: string; logLevel?: string; From dfa35394688d14961b2fc258180f6f15c9c09a45 Mon Sep 17 00:00:00 2001 From: Ika Date: Tue, 22 Sep 2015 12:47:21 +0400 Subject: [PATCH 2/2] Update cometd.d.ts transformed cometD module to interface. usage: ``` var cometd: CometD; ``` added some methods: *clearListeners, clearSubscriptions, handshake, disconnect* added definition for jQuery: `$.cometd` returns CometD type --- cometd/cometd.d.ts | 51 ++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/cometd/cometd.d.ts b/cometd/cometd.d.ts index d5165584c..d6f0f6e2a 100644 --- a/cometd/cometd.d.ts +++ b/cometd/cometd.d.ts @@ -5,26 +5,6 @@ declare module CometD { - var onListenerException: (exception: any, subscriptionHandle: any, isListener: boolean, message: string) => void; - - function init(options: ConfigurationOptions): void; - - function configure(config: ConfigurationOptions): void; - - function addListener(channel: string, listener: (message: any) => void): void; - function removeListener(listener: (message: any) => void): void; - - function clearListeners(): void; - - function clearSubscriptions(): void; - - function handshake(handshake_params: any): void; - - function publish(channel: string, message: any): void; - - - function disconnect(): void; - interface ConfigurationOptions { url: string; logLevel?: string; @@ -37,4 +17,35 @@ declare module CometD { appendMessageTypeToURL?: boolean; autoBatch?: boolean; } + +} + +interface CometD { + + onListenerException: (exception: any, subscriptionHandle: any, isListener: boolean, message: string) => void; + + init(options: CometD.ConfigurationOptions): void; + + configure(config: CometD.ConfigurationOptions): void; + + addListener(channel: string, listener: (message: any) => void): void; + removeListener(listener: (message: any) => void): void; + + clearListeners(): void; + + clearSubscriptions(): void; + + handshake(handshake_params: any): void; + + publish(channel: string, message: any): void; + + + disconnect(): void; + +} + + + +interface JQueryStatic { + cometd: CometD; }