DefinitelyTyped/types/sockjs-client/index.d.ts
Nathan Shively-Sanders f0ce987bc1 Update project urls to match NPM url
Note that this *trivially* updates project urls by adding the NPM url to
the end, even when the urls are almost identical or the DT one is
outdated. I'll clean up the urls in a later commit.

This PR is unfinished! Please do not merge it yet.
2019-02-11 17:10:55 -08:00

54 lines
1.4 KiB
TypeScript

// Type definitions for sockjs-client 1.1
// Project: https://github.com/sockjs/sockjs-client, http://sockjs.org
// Definitions by: Emil Ivanov <https://github.com/vladev>
// Alexander Rusakov <https://github.com/arusakov>
// BendingBender <https://github.com/BendingBender>
// Soner Köksal <https://github.com/renjfk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = SockJS;
export as namespace SockJS;
declare const SockJS: {
new (url: string, _reserved?: any, options?: SockJS.Options): WebSocket;
(url: string, _reserved?: any, options?: SockJS.Options): WebSocket;
prototype: WebSocket;
CONNECTING: SockJS.CONNECTING;
OPEN: SockJS.OPEN;
CLOSING: SockJS.CLOSING;
CLOSED: SockJS.CLOSED;
};
declare namespace SockJS {
type CONNECTING = 0;
type OPEN = 1;
type CLOSING = 2;
type CLOSED = 3;
type State = CONNECTING | OPEN | CLOSING | CLOSED;
interface BaseEvent extends Event {
type: string;
}
type OpenEvent = BaseEvent;
interface CloseEvent extends BaseEvent {
code: number;
reason: string;
wasClean: boolean;
}
interface MessageEvent extends BaseEvent {
data: string;
}
type SessionGenerator = () => string;
interface Options {
server?: string;
sessionId?: number | SessionGenerator;
transports?: string | string[];
}
}