mirror of
https://github.com/raz-varren/sacrificial-socket.git
synced 2024-08-05 10:58:36 +08:00
38 lines
923 B
TypeScript
38 lines
923 B
TypeScript
//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;
|