mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Updated package name for newer versions of Atmosphere package (#20100)
* Updated package name for newer versions of Atmosphere * Fixed header * Created new folder for atmosphere typings and placed deprecation comments. * Fixed tests name * Fixed name in tsconfig
This commit is contained in:
committed by
Ryan Cavanaugh
parent
5669dfcdbc
commit
b3083c9d2c
@@ -0,0 +1,46 @@
|
||||
|
||||
|
||||
var socket = atmosphere;
|
||||
|
||||
var request1:Atmosphere.Request = new atmosphere.AtmosphereRequest();
|
||||
|
||||
request1.url = document.location.toString() + 'chat';
|
||||
request1.contentType = "application/json";
|
||||
request1.transport = 'websocket';
|
||||
request1.fallbackTransport = 'long-polling';
|
||||
|
||||
var request2:Atmosphere.Request = {
|
||||
url: 'http://localhost:8080/chat',
|
||||
contentType: "application/json",
|
||||
logLevel: 'debug',
|
||||
transport: 'websocket',
|
||||
fallbackTransport: 'long-polling'
|
||||
};
|
||||
|
||||
request1.onError = function (response?:Atmosphere.Response) {};
|
||||
request1.onClose = function (response?:Atmosphere.Response) {};
|
||||
request1.onOpen = function (response?:Atmosphere.Response) {};
|
||||
request1.onMessage = function (response:Atmosphere.Response) {};
|
||||
request1.onReopen = function (request?:Atmosphere.Request, response?:Atmosphere.Response) {};
|
||||
request1.onReconnect = function (request?:Atmosphere.Request, response?:Atmosphere.Response) {};
|
||||
request1.onMessagePublished = function (response?:Atmosphere.Response) {};
|
||||
request1.onTransportFailure = function (reason?:string, response?:Atmosphere.Response) {};
|
||||
request1.onLocalMessage = function (request?:Atmosphere.Request) {};
|
||||
request1.onFailureToReconnect = function (request?:Atmosphere.Request, response?:Atmosphere.Response) {};
|
||||
request1.onClientTimeout = function (request?:Atmosphere.Request) {};
|
||||
|
||||
request1.subscribe = function (options:Atmosphere.Request) {};
|
||||
request1.execute = function () {};
|
||||
request1.close = function () {};
|
||||
request1.disconnect = function () {};
|
||||
request1.getUrl = function ():string { return "http://www.toedter.com" };
|
||||
request1.push = function (message:string, dispatchUrl?:string) {};
|
||||
request1.getUUID = function () {};
|
||||
request1.pushLocal = function (message:string) {};
|
||||
|
||||
var subSocket:Atmosphere.Request = socket.subscribe(request1);
|
||||
var subSocket2:Atmosphere.Request = socket.subscribe('http://chat.com', function() {}, request2);
|
||||
subSocket2.close();
|
||||
|
||||
subSocket.push("test");
|
||||
socket.unsubscribe();
|
||||
Vendored
+110
@@ -0,0 +1,110 @@
|
||||
// Type definitions for Atmosphere v2.1.5
|
||||
// Project: https://github.com/Atmosphere/atmosphere-javascript
|
||||
// Definitions by: Kai Toedter <https://github.com/toedter>
|
||||
// Fedor Kirpichev <https://github.com/Mory1879>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Use this typings in future instead of deprecated 'atmosphere'.
|
||||
|
||||
declare namespace Atmosphere {
|
||||
interface Atmosphere {
|
||||
/**
|
||||
* The atmosphere API is a little bit special here: the first parameter can either be
|
||||
* a URL string or a Request object. If it is a URL string, then the additional parameters are expected.
|
||||
*/
|
||||
subscribe?: (requestOrUrl:any, callback?:Function, request?:Request) => Request;
|
||||
unsubscribe?: () => void;
|
||||
|
||||
AtmosphereRequest?: AtmosphereRequest;
|
||||
}
|
||||
|
||||
// needed to fit JavaScript "new atmosphere.AtmosphereRequest()"
|
||||
// and compile with --noImplicitAny
|
||||
interface AtmosphereRequest {
|
||||
new(): Request;
|
||||
}
|
||||
|
||||
interface Request {
|
||||
timeout?: number;
|
||||
method?: string;
|
||||
headers?: any;
|
||||
contentType?: string;
|
||||
callback?: Function;
|
||||
url?: string;
|
||||
data?: string;
|
||||
suspend?: boolean;
|
||||
maxRequest?: number;
|
||||
reconnect?: boolean;
|
||||
maxStreamingLength?: number;
|
||||
lastIndex?: number;
|
||||
logLevel?: string;
|
||||
requestCount?: number;
|
||||
fallbackMethod?: string;
|
||||
fallbackTransport?: string;
|
||||
transport?: string;
|
||||
webSocketImpl?: any;
|
||||
webSocketBinaryType?: any;
|
||||
dispatchUrl?: string;
|
||||
webSocketPathDelimiter?: string;
|
||||
enableXDR?: boolean;
|
||||
rewriteURL?: boolean;
|
||||
attachHeadersAsQueryString?: boolean;
|
||||
executeCallbackBeforeReconnect?: boolean;
|
||||
readyState?: number;
|
||||
lastTimestamp?: number;
|
||||
withCredentials?: boolean;
|
||||
trackMessageLength?: boolean;
|
||||
messageDelimiter?: string;
|
||||
connectTimeout?: number;
|
||||
reconnectInterval?: number;
|
||||
dropHeaders?: boolean;
|
||||
uuid?: string;
|
||||
async?: boolean;
|
||||
shared?: boolean;
|
||||
readResponsesHeaders?: boolean;
|
||||
maxReconnectOnClose?: number;
|
||||
enableProtocol?: boolean;
|
||||
pollingInterval?: number;
|
||||
|
||||
onError?: (response?:Response) => void;
|
||||
onClose?: (response?:Response) => void;
|
||||
onOpen?: (response?:Response) => void;
|
||||
onMessage?: (response:Response) => void;
|
||||
onReopen?: (request?:Request, response?:Response) => void;
|
||||
onReconnect?: (request?:Request, response?:Response) => void;
|
||||
onMessagePublished?: (response?:Response) => void;
|
||||
onTransportFailure?: (reason?:string, response?:Response) => void;
|
||||
onLocalMessage?: (request?:Request) => void;
|
||||
onFailureToReconnect?: (request?:Request, response?:Response) => void;
|
||||
onClientTimeout?: (request?:Request) => void;
|
||||
|
||||
subscribe?: (options:Request) => void;
|
||||
execute?: () => void;
|
||||
close?: () => void;
|
||||
disconnect?: () => void;
|
||||
getUrl?: () => string;
|
||||
push?: (message:string, dispatchUrl?:string) => void;
|
||||
getUUID?: () => void;
|
||||
pushLocal?: (message:string) => void;
|
||||
}
|
||||
|
||||
interface Response {
|
||||
status?: number;
|
||||
reasonPhrase?: string;
|
||||
responseBody?: string;
|
||||
messages?: string[];
|
||||
headers?: string[];
|
||||
state?: string;
|
||||
transport?: string;
|
||||
error?: string;
|
||||
request?: Request;
|
||||
partialMessage?: string;
|
||||
errorHandled?: boolean;
|
||||
closedByClientTimeout?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare var atmosphere:Atmosphere.Atmosphere;
|
||||
declare module 'atmosphere.js' {
|
||||
export = atmosphere;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"atmosphere.js-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+4
-1
@@ -1,8 +1,11 @@
|
||||
// Type definitions for Atmosphere v2.1.5
|
||||
// Project: https://github.com/Atmosphere/atmosphere-javascript
|
||||
// Definitions by: Kai Toedter <https://github.com/toedter>
|
||||
// Definitions by: Kai Toedter <https://github.com/toedter>
|
||||
// Fedor Kirpichev <https://github.com/Mory1879>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// This is deprecated due to module name change. Please use 'atmosphere.js' for future development..
|
||||
|
||||
declare namespace Atmosphere {
|
||||
interface Atmosphere {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user