@types/cometd
Advanced tools
Comparing version 4.0.5 to 4.0.6
@@ -7,2 +7,3 @@ // Type definitions for CometD 4.0 | ||
// Harald Gliebe <https://github.com/hagl> | ||
// P.J. Swesey <https://github.com/swese44> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -85,8 +86,53 @@ // TypeScript Version: 2.3 | ||
export interface Message { | ||
export type ConnectionType = 'long-polling' | 'callback-polling' | 'iframe' | 'flash'; | ||
export type ReconnectAdvice = 'retry' | 'handshake' | 'none'; | ||
export interface BaseMessage { | ||
successful: boolean; | ||
data: any; | ||
channel: string; | ||
id?: string; | ||
clientId?: string; | ||
advice?: { | ||
reconnect?: ReconnectAdvice; | ||
timeout?: number; | ||
interval?: number; | ||
'multiple-clients'?: boolean; | ||
hosts?: string[]; | ||
}; | ||
connectionType?: ConnectionType; | ||
timestamp?: string; | ||
data?: any; | ||
error?: string; | ||
ext?: any; | ||
version?: string; | ||
minimumVersion?: string; | ||
} | ||
export interface SuccessfulHandshakeMessage extends BaseMessage { | ||
successful: true; | ||
version: string; | ||
supportedConnectionTypes: ConnectionType[]; | ||
clientId: string; | ||
authSuccessful?: true; | ||
reestablish: boolean; | ||
} | ||
export interface UnsuccessfulHandshakeMessage extends BaseMessage { | ||
successful: false; | ||
error: string; | ||
supportedConnectionTypes?: ConnectionType[]; | ||
reestablish?: undefined; | ||
} | ||
export type HandshakeMessage = SuccessfulHandshakeMessage | UnsuccessfulHandshakeMessage; | ||
export interface SubscribeMessage extends BaseMessage { | ||
subscription: string; | ||
} | ||
export type Message = BaseMessage | HandshakeMessage | SubscribeMessage; | ||
export type Listener = (message: Message) => void; | ||
export type HandshakeListener = (message: HandshakeMessage) => void; | ||
export type SubscribeListener = (message: SubscribeMessage) => void; | ||
export type Callback = (data: any) => void; | ||
@@ -165,3 +211,3 @@ | ||
*/ | ||
handshake(handshakeCallback: Listener): void; | ||
handshake(handshakeCallback: HandshakeListener): void; | ||
@@ -175,3 +221,3 @@ /** | ||
*/ | ||
handshake(handshakeProps: object, handshakeCallback: Listener): void; | ||
handshake(handshakeProps: object, handshakeCallback: HandshakeListener): void; | ||
@@ -264,3 +310,3 @@ /** | ||
*/ | ||
subscribe(channel: string, callback: Callback, subscribeCallback?: Listener): SubscriptionHandle; | ||
subscribe(channel: string, callback: Callback, subscribeCallback?: SubscribeListener): SubscriptionHandle; | ||
@@ -286,3 +332,8 @@ /** | ||
*/ | ||
subscribe(channel: string, callback: Callback, subscribeProps: object, subscribeCallback?: Listener): SubscriptionHandle; | ||
subscribe( | ||
channel: string, | ||
callback: Callback, | ||
subscribeProps: object, | ||
subscribeCallback?: SubscribeListener, | ||
): SubscriptionHandle; | ||
@@ -295,3 +346,3 @@ /** | ||
*/ | ||
unsubscribe(subscription: SubscriptionHandle, unsubscribeCallback?: Listener): void; | ||
unsubscribe(subscription: SubscriptionHandle, unsubscribeCallback?: SubscribeListener): void; | ||
@@ -305,3 +356,7 @@ /** | ||
*/ | ||
unsubscribe(subscription: SubscriptionHandle, unsubscribeProps: object, unsubscribeCallback?: Listener): void; | ||
unsubscribe( | ||
subscription: SubscriptionHandle, | ||
unsubscribeProps: object, | ||
unsubscribeCallback?: SubscribeListener, | ||
): void; | ||
@@ -360,3 +415,3 @@ /** | ||
meta?: object, | ||
callback?: Listener | ||
callback?: Listener, | ||
): void; | ||
@@ -422,3 +477,3 @@ | ||
*/ | ||
setLogLevel(level: "error" | "warn" | "info" | "debug"): void; | ||
setLogLevel(level: 'error' | 'warn' | 'info' | 'debug'): void; | ||
@@ -499,3 +554,8 @@ /** | ||
*/ | ||
onListenerException: (exception: any, subscriptionHandle: SubscriptionHandle, isListener: boolean, message: string) => void; | ||
onListenerException: ( | ||
exception: any, | ||
subscriptionHandle: SubscriptionHandle, | ||
isListener: boolean, | ||
message: string, | ||
) => void; | ||
} |
{ | ||
"name": "@types/cometd", | ||
"version": "4.0.5", | ||
"version": "4.0.6", | ||
"description": "TypeScript definitions for CometD", | ||
@@ -26,2 +26,7 @@ "license": "MIT", | ||
"githubUsername": "hagl" | ||
}, | ||
{ | ||
"name": "P.J. Swesey", | ||
"url": "https://github.com/swese44", | ||
"githubUsername": "swese44" | ||
} | ||
@@ -38,4 +43,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "9ed2ec42a3f1a09d529384db01863fdf9bc535fa070771a41fc58ec6f969e5b8", | ||
"typesPublisherContentHash": "c3ee3f1eee6497bb410aea99e2810f4b071deff09720b12f7889356cc7b42c8a", | ||
"typeScriptVersion": "2.3" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Mon, 08 Jul 2019 17:15:32 GMT | ||
* Last updated: Tue, 29 Oct 2019 22:49:27 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Derek Cicerone <https://github.com/derekcicerone>, Daniel Perez Alvarez <https://github.com/unindented>, Alex Henry <https://github.com/alxHenry>, and Harald Gliebe <https://github.com/hagl>. | ||
These definitions were written by Derek Cicerone <https://github.com/derekcicerone>, Daniel Perez Alvarez <https://github.com/unindented>, Alex Henry <https://github.com/alxHenry>, Harald Gliebe <https://github.com/hagl>, and P.J. Swesey <https://github.com/swese44>. |
24883
546