mirror of
https://github.com/raz-varren/sacrificial-socket.git
synced 2024-08-05 10:58:36 +08:00
Merge branch 'master' of https://github.com/raz-varren/sacrificial-socket
This commit is contained in:
commit
2089d878c1
37
client/sacrificial-socket.d.ts
vendored
Normal file
37
client/sacrificial-socket.d.ts
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
//sacrificial-socket.d.ts is the type definition file for sacrificial-socket.js
|
||||||
|
//
|
||||||
|
//because the sacrificial-socket client is just a class constructor
|
||||||
|
//the way to import this into TypeScript is with:
|
||||||
|
// import SS = require('sacrificial-socket');
|
||||||
|
|
||||||
|
declare namespace SS {
|
||||||
|
export interface connOpts{
|
||||||
|
enabled?: boolean;
|
||||||
|
replayOnConnect?: boolean;
|
||||||
|
intervalMS?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ssOpts{
|
||||||
|
reconnectOpts?: connOpts;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare class SS{
|
||||||
|
constructor(url: string, opts?: SS.ssOpts);
|
||||||
|
|
||||||
|
noop(): void;
|
||||||
|
|
||||||
|
onConnect(callback: (event: any) => void): void;
|
||||||
|
onDisconnect(callback: (event: any) => void): void;
|
||||||
|
|
||||||
|
on(eventName: string, callback: (data: any) => void): void;
|
||||||
|
off(eventName: string): void;
|
||||||
|
|
||||||
|
emit(eventName: string, data: any): void;
|
||||||
|
|
||||||
|
close(): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export = SS;
|
Loading…
Reference in New Issue
Block a user