feat: add 1.8.8 reflect & export io namespace

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2020-04-07 13:31:20 +08:00
parent d22b72f10a
commit 1c29a059d9
5 changed files with 53 additions and 5 deletions

View File

@@ -1,3 +1,46 @@
/// <reference types="@ms/nashorn" />
export * from './socket-io'
import { Server, ServerOptions } from './socket-io'
interface SocketIOStatic {
/**
* Default Server constructor
*/
(): Server;
/**
* Creates a new Server
* @param srv The HTTP server that we're going to bind to
* @param opts An optional parameters object
*/
(srv: any, opts?: ServerOptions): Server;
/**
* Creates a new Server
* @param port A port to bind to, as a number, or a string
* @param An optional parameters object
*/
(port: string | number, opts?: ServerOptions): Server;
/**
* Creates a new Server
* @param A parameters object
*/
(opts: ServerOptions): Server;
/**
* Backwards compatibility
* @see io().listen()
*/
listen?: SocketIOStatic;
}
type SocketStatic = SocketIOStatic & { Instance?: symbol }
// @ts-ignore
let io: SocketStatic = function (pipeline: any, options: ServerOptions) {
return new Server(pipeline, options)
}
io.Instance = Symbol("@ms/websocket")
export default io
export * from './socket-io'