adding a TypeScript type definition file for the sacrificial-socket client js

This commit is contained in:
skedar46
2018-03-28 20:14:30 -07:00
parent ad769a9e40
commit b1e7b3f229

37
client/sacrificial-socket.d.ts vendored Normal file
View 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;