@types/socket.io
Advanced tools
Comparing version 2.1.6 to 2.1.7
@@ -17,2 +17,3 @@ // Type definitions for socket.io 2.1 | ||
import engine = require('engine.io'); | ||
import { EventEmitter } from 'events'; | ||
export = SocketIO; | ||
@@ -40,3 +41,3 @@ /** @deprecated Available as a global for backwards-compatibility. */ | ||
*/ | ||
(port: string|number, opts?: SocketIO.ServerOptions): SocketIO.Server; | ||
(port: string | number, opts?: SocketIO.ServerOptions): SocketIO.Server; | ||
@@ -63,3 +64,3 @@ /** | ||
*/ | ||
nsps: {[namespace: string]: Namespace}; | ||
nsps: { [namespace: string]: Namespace }; | ||
@@ -93,3 +94,3 @@ /** | ||
*/ | ||
checkRequest( req:any, fn:( err: any, success: boolean ) => void ):void; | ||
checkRequest(req: any, fn: (err: any, success: boolean) => void): void; | ||
@@ -108,3 +109,3 @@ /** | ||
*/ | ||
serveClient( v: boolean ): Server; | ||
serveClient(v: boolean): Server; | ||
@@ -123,3 +124,3 @@ /** | ||
*/ | ||
path( v: string ): Server; | ||
path(v: string): Server; | ||
@@ -138,3 +139,3 @@ /** | ||
*/ | ||
adapter( v: any ): Server; | ||
adapter(v: any): Server; | ||
@@ -145,3 +146,3 @@ /** | ||
*/ | ||
origins(): string|string[]; | ||
origins(): string | string[]; | ||
@@ -154,3 +155,3 @@ /** | ||
*/ | ||
origins( v: string|string[] ): Server; | ||
origins(v: string | string[]): Server; | ||
@@ -166,3 +167,3 @@ /** | ||
*/ | ||
origins( fn: ( origin: string, callback: ( error: string | null, success: boolean ) => void ) => void ): Server; | ||
origins(fn: (origin: string, callback: (error: string | null, success: boolean) => void) => void): Server; | ||
@@ -175,3 +176,3 @@ /** | ||
*/ | ||
attach( srv: any, opts?: ServerOptions ): Server; | ||
attach(srv: any, opts?: ServerOptions): Server; | ||
@@ -184,3 +185,3 @@ /** | ||
*/ | ||
attach( port: number, opts?: ServerOptions ): Server; | ||
attach(port: number, opts?: ServerOptions): Server; | ||
@@ -190,3 +191,3 @@ /** | ||
*/ | ||
listen( srv: any, opts?: ServerOptions ): Server; | ||
listen(srv: any, opts?: ServerOptions): Server; | ||
@@ -196,3 +197,3 @@ /** | ||
*/ | ||
listen( port: number, opts?: ServerOptions ): Server; | ||
listen(port: number, opts?: ServerOptions): Server; | ||
@@ -204,3 +205,3 @@ /** | ||
*/ | ||
bind( srv: any ): Server; | ||
bind(srv: any): Server; | ||
@@ -212,3 +213,3 @@ /** | ||
*/ | ||
onconnection( socket: any ): Server; | ||
onconnection(socket: any): Server; | ||
@@ -221,3 +222,3 @@ /** | ||
*/ | ||
of( nsp: string | RegExp | Function ): Namespace; | ||
of(nsp: string | RegExp | Function): Namespace; | ||
@@ -227,3 +228,3 @@ /** | ||
*/ | ||
close( fn ?: () => void ):void; | ||
close(fn?: () => void): void; | ||
@@ -236,3 +237,3 @@ /** | ||
*/ | ||
on( event: 'connection', listener: ( socket: Socket ) => void ): Namespace; | ||
on(event: 'connection', listener: (socket: Socket) => void): Namespace; | ||
@@ -242,3 +243,3 @@ /** | ||
*/ | ||
on( event: 'connect', listener: ( socket: Socket ) => void ): Namespace; | ||
on(event: 'connect', listener: (socket: Socket) => void): Namespace; | ||
@@ -252,3 +253,3 @@ /** | ||
*/ | ||
on( event: string, listener: Function ): Namespace; | ||
on(event: string, listener: Function): Namespace; | ||
@@ -260,3 +261,3 @@ /** | ||
*/ | ||
to( room: string ): Namespace; | ||
to(room: string): Namespace; | ||
@@ -266,3 +267,3 @@ /** | ||
*/ | ||
in( room: string ): Namespace; | ||
in(room: string): Namespace; | ||
@@ -279,3 +280,3 @@ /** | ||
*/ | ||
use( fn: ( socket:Socket, fn: ( err?: any ) => void ) =>void ): Namespace; | ||
use(fn: (socket: Socket, fn: (err?: any) => void) => void): Namespace; | ||
@@ -290,3 +291,3 @@ /** | ||
*/ | ||
emit( event: string, ...args: any[]): Namespace; | ||
emit(event: string, ...args: any[]): Namespace; | ||
@@ -298,3 +299,3 @@ /** | ||
*/ | ||
send( ...args: any[] ): Namespace; | ||
send(...args: any[]): Namespace; | ||
@@ -304,3 +305,3 @@ /** | ||
*/ | ||
write( ...args: any[] ): Namespace; | ||
write(...args: any[]): Namespace; | ||
@@ -311,3 +312,3 @@ /** | ||
*/ | ||
clients( ...args: any[] ): Namespace; | ||
clients(...args: any[]): Namespace; | ||
@@ -318,3 +319,141 @@ /** | ||
*/ | ||
compress( ...args: any[] ): Namespace; | ||
compress(...args: any[]): Namespace; | ||
// Socket inherits the following methods from NodeJS.EventEmitter | ||
// https://github.com/socketio/socket.io/blob/2.1.1/lib/socket.js#L81 | ||
/** | ||
* Alias for `on` | ||
* @param event The event that we want to add a listener for | ||
* @param listener The callback to call when we get the event. The parameters | ||
* for the callback depend on the event | ||
* @return The default '/' Namespace | ||
* | ||
* _Inherited from EventEmitter - https://nodejs.org/api/events.html_ | ||
*/ | ||
addListener(event: string, listener: (...args: any[]) => void): Namespace; | ||
/** | ||
* Adds a one-time listener for an event | ||
* @param event The event that we want to add a listener for | ||
* @param listener The callback to call when we get the event. The parameters | ||
* for the callback depend on the event | ||
* @return The default '/' Namespace | ||
* | ||
* _Inherited from EventEmitter - https://nodejs.org/api/events.html_ | ||
*/ | ||
once(event: string, listener: (...args: any[]) => void): Namespace; | ||
/** | ||
* Removes a specific listener for an event | ||
* @param event The event that we want to add a listener for | ||
* @param listener The callback to remove from the event event. Must be | ||
* the exact function reference that was added | ||
* @return The default '/' Namespace | ||
* | ||
* _Inherited from EventEmitter - https://nodejs.org/api/events.html_ | ||
*/ | ||
removeListener(event: string, listener: (...args: any[]) => void): Namespace; | ||
/** | ||
* Alias for `removeListener` | ||
* @param event The event that we want to add a listener for | ||
* @param listener The callback to remove from the event event. Must be | ||
* the exact function reference that was added | ||
* @return The default '/' Namespace | ||
* | ||
* _Inherited from EventEmitter - https://nodejs.org/api/events.html_ | ||
*/ | ||
off(event: string, listener: (...args: any[]) => void): Namespace; | ||
/** | ||
* Removes all listeners, or those of the specified event | ||
* | ||
* @param event The event to remove all listeners for, if omitted | ||
* all events will be removed | ||
* @return The default '/' Namespace | ||
* | ||
* _Inherited from EventEmitter - https://nodejs.org/api/events.html_ | ||
*/ | ||
removeAllListeners(event?: string): Namespace; | ||
/** | ||
* Sets the max amount of event listeners | ||
* | ||
* @param n The max amount of allowed event listeners. | ||
* @return The default '/' Namespace | ||
* | ||
* _Inherited from EventEmitter - https://nodejs.org/api/events.html_ | ||
*/ | ||
setMaxListeners(n: number): Namespace; | ||
/** | ||
* Gets the max amount of event listeners | ||
* | ||
* @return The max amount of allowed event listeners. | ||
* | ||
* _Inherited from EventEmitter - https://nodejs.org/api/events.html_ | ||
*/ | ||
getMaxListeners(): number; | ||
/** | ||
* Gets a copy of all listeners for an event. | ||
* | ||
* @param event The event to retrieve all listeners for | ||
* @return A copy of the array of listeners for the event | ||
* | ||
* _Inherited from EventEmitter - https://nodejs.org/api/events.html_ | ||
*/ | ||
listeners(event: string): Function[]; | ||
/** | ||
* Get a copy of all listeners for an event, including one-time events. | ||
* | ||
* @param event The event to retrieve all listeners for | ||
* @return A copy of the array of listeners for the event, | ||
* including any wrappers (such as those created by .once()). | ||
* | ||
* _Inherited from EventEmitter - https://nodejs.org/api/events.html_ | ||
*/ | ||
rawListeners(event: string): Function[]; | ||
/** | ||
* Get a copy of all listeners for an event, including one-time events. | ||
* @param event The event to retrieve all listeners for | ||
* @return The number of listeners listening to the event | ||
* | ||
* _Inherited from EventEmitter - https://nodejs.org/api/events.html_ | ||
*/ | ||
listenerCount(type: string): number; | ||
/** | ||
* Adds the listener function to the _beginning_ of the listeners array for the event | ||
* @param event The event that we want to add a listener for | ||
* @param listener The callback to call when we get the event. The parameters | ||
* for the callback depend on the event | ||
* @return The default '/' Namespace | ||
* | ||
* _Inherited from EventEmitter - https://nodejs.org/api/events.html_ | ||
*/ | ||
prependListener(event: string, listener: (...args: any[]) => void): Namespace; | ||
/** | ||
* Adds a one-time listener function to the _beginning_ of the listeners array for the event | ||
* @param event The event that we want to add a listener for | ||
* @param listener The callback to call when we get the event. The parameters | ||
* for the callback depend on the event | ||
* @return The default '/' Namespace | ||
* | ||
* _Inherited from EventEmitter - https://nodejs.org/api/events.html_ | ||
*/ | ||
prependOnceListener(event: string, listener: (...args: any[]) => void): Namespace; | ||
/** | ||
* Gets an array of events for which listeners have been registered | ||
* @param event The event that we want to add a listener for | ||
* @return An array listing the events for which the emitter has registered listeners | ||
* | ||
* _Inherited from EventEmitter - https://nodejs.org/api/events.html_ | ||
*/ | ||
eventNames(): string[]; | ||
} | ||
@@ -326,3 +465,2 @@ | ||
interface ServerOptions extends engine.ServerAttachOptions { | ||
/** | ||
@@ -351,3 +489,3 @@ * The path to server the client file to | ||
*/ | ||
origins?: string|string[]; | ||
origins?: string | string[]; | ||
} | ||
@@ -360,3 +498,2 @@ | ||
interface Namespace extends NodeJS.EventEmitter { | ||
/** | ||
@@ -404,3 +541,3 @@ * The name of the NameSpace | ||
*/ | ||
use( fn: ( socket:Socket, fn: ( err?: any ) => void ) =>void ): Namespace; | ||
use(fn: (socket: Socket, fn: (err?: any) => void) => void): Namespace; | ||
@@ -412,3 +549,3 @@ /** | ||
*/ | ||
to( room: string ): Namespace; | ||
to(room: string): Namespace; | ||
@@ -418,3 +555,3 @@ /** | ||
*/ | ||
in( room: string ): Namespace; | ||
in(room: string): Namespace; | ||
@@ -426,3 +563,3 @@ /** | ||
*/ | ||
send( ...args: any[] ): Namespace; | ||
send(...args: any[]): Namespace; | ||
@@ -432,3 +569,3 @@ /** | ||
*/ | ||
write( ...args: any[] ): Namespace; | ||
write(...args: any[]): Namespace; | ||
@@ -441,3 +578,3 @@ /** | ||
*/ | ||
on( event: 'connection', listener: ( socket: Socket ) => void ): this; | ||
on(event: 'connection', listener: (socket: Socket) => void): this; | ||
@@ -447,3 +584,3 @@ /** | ||
*/ | ||
on( event: 'connect', listener: ( socket: Socket ) => void ): this; | ||
on(event: 'connect', listener: (socket: Socket) => void): this; | ||
@@ -457,3 +594,3 @@ /** | ||
*/ | ||
on( event: string, listener: Function ): this; | ||
on(event: string, listener: Function): this; | ||
@@ -464,3 +601,3 @@ /** | ||
*/ | ||
clients( fn: Function ): Namespace; | ||
clients(fn: Function): Namespace; | ||
@@ -472,3 +609,3 @@ /** | ||
*/ | ||
compress( compress: boolean ): Namespace; | ||
compress(compress: boolean): Namespace; | ||
} | ||
@@ -497,4 +634,3 @@ | ||
*/ | ||
interface Socket extends NodeJS.EventEmitter{ | ||
interface Socket extends NodeJS.EventEmitter { | ||
/** | ||
@@ -581,3 +717,3 @@ * The namespace that this socket is for | ||
*/ | ||
to( room: string ): Socket; | ||
to(room: string): Socket; | ||
@@ -587,3 +723,3 @@ /** | ||
*/ | ||
in( room: string ): Socket; | ||
in(room: string): Socket; | ||
@@ -595,3 +731,3 @@ /** | ||
*/ | ||
use( fn: ( packet: Packet, next: (err?: any) => void ) => void ): Socket; | ||
use(fn: (packet: Packet, next: (err?: any) => void) => void): Socket; | ||
@@ -602,3 +738,3 @@ /** | ||
*/ | ||
send( ...args: any[] ): Socket; | ||
send(...args: any[]): Socket; | ||
@@ -608,3 +744,3 @@ /** | ||
*/ | ||
write( ...args: any[] ): Socket; | ||
write(...args: any[]): Socket; | ||
@@ -619,3 +755,3 @@ /** | ||
*/ | ||
join( name: string|string[], fn?: ( err?: any ) => void ): Socket; | ||
join(name: string | string[], fn?: (err?: any) => void): Socket; | ||
@@ -628,3 +764,3 @@ /** | ||
*/ | ||
leave( name: string, fn?: Function ): Socket; | ||
leave(name: string, fn?: Function): Socket; | ||
@@ -641,3 +777,3 @@ /** | ||
*/ | ||
disconnect( close?: boolean ): Socket; | ||
disconnect(close?: boolean): Socket; | ||
@@ -649,3 +785,3 @@ /** | ||
*/ | ||
listeners( event: string ):Function[]; | ||
listeners(event: string): Function[]; | ||
@@ -657,3 +793,3 @@ /** | ||
*/ | ||
compress( compress: boolean ): Socket; | ||
compress(compress: boolean): Socket; | ||
@@ -714,3 +850,3 @@ /** | ||
interface Room { | ||
sockets: {[id: string]: boolean }; | ||
sockets: { [id: string]: boolean }; | ||
length: number; | ||
@@ -724,5 +860,5 @@ } | ||
interface Rooms { | ||
interface Rooms { | ||
[room: string]: Room; | ||
} | ||
} | ||
@@ -733,3 +869,2 @@ /** | ||
interface Adapter extends NodeJS.EventEmitter { | ||
/** | ||
@@ -749,3 +884,3 @@ * The namespace that this adapter is for | ||
*/ | ||
sids: {[id: string]: {[room: string]: boolean}}; | ||
sids: { [id: string]: { [room: string]: boolean } }; | ||
@@ -759,3 +894,3 @@ /** | ||
*/ | ||
add( id: string, room: string, callback?: ( err?: any ) => void ): void; | ||
add(id: string, room: string, callback?: (err?: any) => void): void; | ||
@@ -770,3 +905,3 @@ /** | ||
*/ | ||
del( id: string, room: string, callback?: ( err?: any ) => void ): void; | ||
del(id: string, room: string, callback?: (err?: any) => void): void; | ||
@@ -777,3 +912,3 @@ /** | ||
*/ | ||
delAll( id: string ):void; | ||
delAll(id: string): void; | ||
@@ -788,3 +923,6 @@ /** | ||
*/ | ||
broadcast( packet: any, opts: { rooms?: string[]; except?: string[]; flags?: {[flag: string]: boolean} } ):void; | ||
broadcast( | ||
packet: any, | ||
opts: { rooms?: string[]; except?: string[]; flags?: { [flag: string]: boolean } }, | ||
): void; | ||
} | ||
@@ -821,3 +959,3 @@ | ||
*/ | ||
sockets: {[id: string]: Socket}; | ||
sockets: { [id: string]: Socket }; | ||
@@ -828,3 +966,3 @@ /** | ||
*/ | ||
nsps: {[nsp: string]: Socket}; | ||
nsps: { [nsp: string]: Socket }; | ||
} | ||
@@ -831,0 +969,0 @@ |
{ | ||
"name": "@types/socket.io", | ||
"version": "2.1.6", | ||
"version": "2.1.7", | ||
"description": "TypeScript definitions for socket.io", | ||
@@ -60,4 +60,4 @@ "license": "MIT", | ||
}, | ||
"typesPublisherContentHash": "0e400fadd87f60d334ae230b88f90ff3348c23c3d079a89d89aac519021f4efc", | ||
"typesPublisherContentHash": "467f2faf9d38fdb164931374a3c6dd44178a9faf47e194c6dce410adbba19cf2", | ||
"typeScriptVersion": "3.0" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Sun, 17 May 2020 14:31:23 GMT | ||
* Last updated: Thu, 21 May 2020 12:21:40 GMT | ||
* Dependencies: [@types/engine.io](https://npmjs.com/package/@types/engine.io), [@types/node](https://npmjs.com/package/@types/node) | ||
@@ -14,0 +14,0 @@ * Global values: `SocketIO` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33967
813