From 9e13e02ace794fba00f44bcf70f41cdca1a56b4e Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 15 Jun 2016 15:59:48 +0300 Subject: [PATCH] Updated definitions for wampy.js v3.0.x --- wampy/wampy-tests.ts | 5 +++-- wampy/wampy.d.ts | 22 +++++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/wampy/wampy-tests.ts b/wampy/wampy-tests.ts index f7dcf9fe52..c0ac8d6656 100644 --- a/wampy/wampy-tests.ts +++ b/wampy/wampy-tests.ts @@ -13,7 +13,8 @@ ws.options({ onConnect: function () { console.log('Yahoo! We are online!'); }, onClose: function () { console.log('See you next time!'); }, onError: function () { console.log('Breakdown happened'); }, - onReconnect: function () { console.log('Reconnecting...'); } + onReconnect: function () { console.log('Reconnecting...'); }, + onReconnectSuccess: function () { console.log('Successfully reconnected!'); } }); ws.connect(); @@ -93,7 +94,7 @@ var status = ws.getOpStatus(); ws.cancel(status.reqId); -var sqrt_f = function (x: number) { return x*x; }; +var sqrt_f = function (x: number, y: any) { return [{}, x*x]; }; ws.register('sqrt.value', sqrt_f); diff --git a/wampy/wampy.d.ts b/wampy/wampy.d.ts index 650a8a91a5..e068b97a25 100644 --- a/wampy/wampy.d.ts +++ b/wampy/wampy.d.ts @@ -1,4 +1,4 @@ -// Type definitions for wampy.js v2.0.1 +// Type definitions for wampy.js v3.0.x // Project: https://github.com/KSDaemon/wampy.js // Definitions by: Konstantin Burkalev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,10 +12,13 @@ declare module "wampy" { transportEncoding?: string; realm?: string; helloCustomDetails?: any; + onChallenge?: (auth_method: string, challenge_details: string) => string; + authid?: string; onConnect?: () => void; onClose?: () => void; onError?: () => void; onReconnect?: () => void; + onReconnectSuccess?: () => void; ws?: any; msgpackCoder?: any; } @@ -36,7 +39,7 @@ declare module "wampy" { } interface RegisterCallbacksHash extends SuccessErrorCallbacksHash { - rpc: (data: any) => any; + rpc: (data: any, options: any) => any[]; } interface CallSuccessErrorCallbacksHash { @@ -51,8 +54,17 @@ declare module "wampy" { disclose_me?: boolean; } - interface CallAdvancedOptions extends AdvancedOptions { + interface PublishAdvancedOptions extends AdvancedOptions { + exclude_authid?: string | string[]; + exclude_authrole?: string | string[]; + eligible_authid?: string | string[]; + eligible_authrole?: string | string[]; + } + + interface CallAdvancedOptions { + disclose_me?: boolean; receive_progress?: boolean; + timeout?: number; } interface CancelAdvancedOptions { @@ -71,7 +83,7 @@ declare module "wampy" { publish(topicURI: string, payload?: any, callbacks?: SuccessErrorCallbacksHash, - advancedOptions?: AdvancedOptions): Wampy; + advancedOptions?: PublishAdvancedOptions): Wampy; call(topicURI: string, payload?: any, callbacks?: (((data: any) => void) | CallSuccessErrorCallbacksHash), @@ -79,7 +91,7 @@ declare module "wampy" { cancel(reqId: number, callbacks?: ((() => void) | SuccessErrorCallbacksHash), advancedOptions?: CancelAdvancedOptions): Wampy; - register(topicURI: string, callbacks: (((data: any) => any) | RegisterCallbacksHash)): Wampy; + register(topicURI: string, callbacks: (((data: any, options: any) => any[]) | RegisterCallbacksHash)): Wampy; unregister(topicURI: string, callbacks?: ((() => void) | SuccessErrorCallbacksHash)): Wampy; }