diff --git a/types/fm-websync/index.d.ts b/types/fm-websync/index.d.ts index ae3677b986..f118ebe051 100644 --- a/types/fm-websync/index.d.ts +++ b/types/fm-websync/index.d.ts @@ -10,7 +10,10 @@ declare namespace fm interface initializeConfig { /** - * If set to true, an asynchronous disconnect request will be launched when the page unloads. If set to false, no automatic disconnection will be attempted. If set to an object, then a disconnect request will be launched when the page unloads using the object as the disconnect configuration. (See disconnectConfig for details.) Note that automatic disconnects are a best-effort. The only way to guarantee success is to execute the disconnect synchronously and target a request URL on the same domain as the page ({ sync: true, requestUrl: '...relative path.../request.ashx' }). Defaults to false. + * If set to true, an asynchronous disconnect request will be launched when the page unloads. If set to false, no automatic disconnection will be attempted. + * If set to an object, then a disconnect request will be launched when the page unloads using the object as the disconnect configuration. + * (See disconnectConfig for details.) Note that automatic disconnects are a best-effort. The only way to guarantee success is to execute the disconnect synchronously + * and target a request URL on the same domain as the page ({ sync: true, requestUrl: '...relative path.../request.ashx' }). Defaults to false. */ autoDisconnect?: boolean; @@ -21,12 +24,15 @@ declare namespace fm backoffInterval?: number; /** - * The URL of the HTML frame to be used with HTML5 postMessage for cross-domain environments. Must have the same domain as requestUrl. Defaults to a dynamically generated URL based on the host of the client script URL (or the host web.config attribute, if specified) and the path to the WebSync Server ClientHandler registered in web.config with "frame" added to the query. + * The URL of the HTML frame to be used with HTML5 postMessage for cross-domain environments. Must have the same domain as requestUrl. + * Defaults to a dynamically generated URL based on the host of the client script URL (or the host web.config attribute, if specified) and the path to the WebSync Server + * ClientHandler registered in web.config with "frame" added to the query. */ clientFrameUrl?: string; /** - * The domain key to send with each request. If using WebSync On-Demand, this should be set to the public or private API key specified in the Frozen Mountain Portal. If using WebSync Server, this should be used only if grouping connections. Defaults to "11111111-1111-1111-1111-111111111111". + * The domain key to send with each request. If using WebSync On-Demand, this should be set to the public or private API key specified in the Frozen Mountain Portal. + * If using WebSync Server, this should be used only if grouping connections. Defaults to "11111111-1111-1111-1111-111111111111". */ key?: string; @@ -51,7 +57,9 @@ declare namespace fm quiet?: boolean; /** - * The URL of the WebSync request handler. This URL typically ends with request.ashx. Must have the same domain as clientFrameUrl. Defaults to a dynamically generated URL based on the host of the client script URL (or the host web.config attribute, if specified) and the path to the WebSync Server RequestHandler registered in web.config. + * The URL of the WebSync request handler. This URL typically ends with request.ashx. Must have the same domain as clientFrameUrl. + * Defaults to a dynamically generated URL based on the host of the client script URL (or the host web.config attribute, if specified) and the path to the + * WebSync Server RequestHandler registered in web.config. */ requestUrl?: string; @@ -64,9 +72,13 @@ declare namespace fm * The URLs to use for streaming connections. Three properties are available: * * requestUrl: string - * Same as the root requestUrl parameter, but used for streaming connections. Must have the same domain as stream.clientFrameUrl. Defaults to a dynamically generated URL based on the host of the client script URL (or the streamHost web.config attribute, if specified) and the path to the WebSync Server RequestHandler registered in web.config. + * Same as the root requestUrl parameter, but used for streaming connections. Must have the same domain as stream.clientFrameUrl. + * Defaults to a dynamically generated URL based on the host of the client script URL (or the streamHost web.config attribute, if specified) and the path to the + * WebSync Server RequestHandler registered in web.config. * clientFrameUrl: string - * Same as the root clientFrameUrl parameter, but used for streaming connections. Must have the same domain as stream.requestUrl. Defaults to a dynamically generated URL based on the host of the client script URL (or the streamHost web.config attribute, if specified) and the path to the WebSync Server ClientHandler registered in web.config with "frame" added to the query. + * Same as the root clientFrameUrl parameter, but used for streaming connections. Must have the same domain as stream.requestUrl. + * Defaults to a dynamically generated URL based on the host of the client script URL (or the streamHost web.config attribute, if specified) and the path to the + * WebSync Server ClientHandler registered in web.config with "frame" added to the query. * timeout: number * Same as the root timeout parameter, but used for streaming connections. Defaults to the root timeout + 25000 (25 seconds). */ @@ -84,7 +96,8 @@ declare namespace fm token?: string; /** - * An object specifying URLs to be used for specific client methods. Overrides initializeConfig.requestUrl for the specified method type, but can be overridden by the requestUrl specified in individual method configurations. + * An object specifying URLs to be used for specific client methods. Overrides initializeConfig.requestUrl for the specified method type, but can be overridden + * by the requestUrl specified in individual method configurations. * * connect: string * The URL to use for all client.connect requests. @@ -126,12 +139,15 @@ declare namespace fm requestUrl?: string; /** - * Whether to ignore errors when parsing the server response. If true, any errors thrown while parsing the JSON response received from the server will be ignored. Defaults to false. + * Whether to ignore errors when parsing the server response. If true, any errors thrown while parsing the JSON response received from the server will be ignored. + * Defaults to false. */ suppressErrors?: boolean; /** - * Whether the request should be executed asynchronously. If true, the request will be executed synchronously if supported by the browser; otherwise, it will be executed asynchronously. All browsers support synchronous requests if the request URL is the same domain as the page. Synchronous requests are not supported in IE6 and IE7 for cross-domain environments. Defaults to false. + * Whether the request should be executed asynchronously. If true, the request will be executed synchronously if supported by the browser; otherwise, + * it will be executed asynchronously. All browsers support synchronous requests if the request URL is the same domain as the page. Synchronous requests + * are not supported in IE6 and IE7 for cross-domain environments. Defaults to false. */ sync?: boolean; } @@ -150,9 +166,11 @@ declare namespace fm /** * The callback to invoke if the streaming connection fails. See streamFailureArgs for callback argument details. - * This method will be invoked if (a) the connection was lost, automatic retries succeeded, but the client had idled on the server (and so needs to reconnect), or (b) the connection was lost and automatic retries failed. In the former case, willReconnect is true, and in the latter case, willReconnect is false. + * This method will be invoked if (a) the connection was lost, automatic retries succeeded, but the client had idled on the server (and so needs to reconnect), + * or (b) the connection was lost and automatic retries failed. In the former case, willReconnect is true, and in the latter case, willReconnect is false. * See client for more details on these two scenarios. - * If willReconnect is true, the client will automatically reconnect. If the reconnect succeeds, the callback specified by onSuccess will be invoked with isReconnect set to true. If the reconnect fails, the callback specified by onFailure will be invoked with isReconnect set to false. + * If willReconnect is true, the client will automatically reconnect. If the reconnect succeeds, the callback specified by onSuccess will be invoked with isReconnect set to true. + * If the reconnect fails, the callback specified by onFailure will be invoked with isReconnect set to false. * With the exception of UI updates, invocations of this callback with willReconnect set to true can be ignored. */ onStreamFailure?: ( args: streamFailureArgs ) => void; @@ -164,12 +182,13 @@ declare namespace fm /** * The callback to invoke when a message is received on a channel that has no local callback specified to handle it. See receiveArgs for callback argument details. - * This can occur if (a) a client is manually subscribed to a channel by the server or (b) a client subscribed to a channel and then manually removed the local callback using client.unsetHandler. + * This can occur if (a) a client is manually subscribed to a channel by the server or (b) a client subscribed to a channel and then manually removed the local callback using client. */ - onUnhandledReceive?: Function; + onUnhandledReceive?: ( args: receiveArgs ) => void; /** - * Whether to always attempt to stay connected in the event of network failure. If true, the client will continually reconnect, even after exhausting the specified number of retries specified by initializeConfig.retries. If false, the client will stop reconnecting if all retry attempts fail. + * Whether to always attempt to stay connected in the event of network failure. If true, the client will continually reconnect, even after exhausting the specified number + * of retries specified by initializeConfig.retries. If false, the client will stop reconnecting if all retry attempts fail. */ stayConnected?: boolean; } @@ -179,12 +198,12 @@ declare namespace fm /** * The channel to which the client should be subscribed. Must start with a forward slash (/). Overrides channels. */ - channel?: String; + channel?: string; /** * The channels to which the client should be subscribed. Each must start with a forward slash (/). Overrides channel. */ - channels?: String[]; + channels?: string[]; /** * The callback to invoke after onSuccess or onFailure. See subscribeCompleteArgs for callback argument details. @@ -455,7 +474,9 @@ declare namespace fm { /** * Sets up and maintains a streaming connection to the server. - * While this method will typically run asychronously, the WebSync client is designed to be used without (much) consideration for its asynchronous nature. To that end, any calls to methods that require an active connection, like bind, subscribe and publish, will be queued automatically and executed once this method has completed successfully. + * While this method will typically run asychronously, the WebSync client is designed to be used without (much) consideration for its asynchronous nature. + * To that end, any calls to methods that require an active connection, like bind, subscribe and publish, will be queued automatically and executed once this + * method has completed successfully. * * @param connectConfig */ @@ -464,7 +485,8 @@ declare namespace fm /** * * @param config Takes down a streaming connection to the server and unsubscribes the client. - * After the disconnect completes successfully, any further calls to methods that require an active connection, like bind, subscribe and publish, will be queued automatically and executed only if/when the client reconnects. + * After the disconnect completes successfully, any further calls to methods that require an active connection, like bind, subscribe and publish, will be queued + * automatically and executed only if/when the client reconnects. */ public disconnect( config: disconnectConfig ): client; @@ -476,7 +498,8 @@ declare namespace fm /** * Subscribes the client to receive messages on one or more channels. - * When the subscribe completes successfully, the callback specified by onSuccess will be invoked, passing in the subscribed channel(s), including any modifications made on the server. + * When the subscribe completes successfully, the callback specified by onSuccess will be invoked, passing in the subscribed channel(s), + * including any modifications made on the server. */ public subscribe( config: subscribeConfig ): client; }