mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
class Socket extends EventEmitter
https://github.com/socketio/socket.io/blob/master/lib/socket.js#L81
This commit is contained in:
Vendored
+1
-59
@@ -472,7 +472,7 @@ declare namespace SocketIO {
|
||||
* as we have a problem with the emit() event (as it's overridden with a
|
||||
* different return)
|
||||
*/
|
||||
interface Socket {
|
||||
interface Socket extends NodeJS.EventEmitter{
|
||||
|
||||
/**
|
||||
* The namespace that this socket is for
|
||||
@@ -613,17 +613,6 @@ declare namespace SocketIO {
|
||||
*/
|
||||
broadcast: Socket;
|
||||
|
||||
/**
|
||||
* Emits an event to this client. If the 'broadcast' flag was set, this will
|
||||
* emit to all other clients, except for this one
|
||||
* @param event The event that we want to emit
|
||||
* @param args Any number of optional arguments to pass with the event. If the
|
||||
* last argument is a function, it will be called as an ack. The ack should
|
||||
* take whatever data was sent with the packet
|
||||
* @return This Socket
|
||||
*/
|
||||
emit( event: string, ...args: any[]): Socket;
|
||||
|
||||
/**
|
||||
* Targets a room when broadcasting
|
||||
* @param room The name of the room that we're targeting
|
||||
@@ -677,53 +666,6 @@ declare namespace SocketIO {
|
||||
*/
|
||||
disconnect( close?: boolean ): Socket;
|
||||
|
||||
/**
|
||||
* Adds a listener for a particular event. Calling multiple times will add
|
||||
* multiple listeners
|
||||
* @param event The event that we're listening for
|
||||
* @param fn The function to call when we get the event. Parameters depend on the
|
||||
* event in question
|
||||
* @return This Socket
|
||||
*/
|
||||
on( event: string, fn: Function ): Socket;
|
||||
|
||||
/**
|
||||
* @see on( event, fn )
|
||||
*/
|
||||
addListener( event: string, fn: Function ): Socket;
|
||||
|
||||
/**
|
||||
* Adds a listener for a particular event that will be invoked
|
||||
* a single time before being automatically removed
|
||||
* @param event The event that we're listening for
|
||||
* @param fn The function to call when we get the event. Parameters depend on
|
||||
* the event in question
|
||||
* @return This Socket
|
||||
*/
|
||||
once( event: string, fn: Function ): Socket;
|
||||
|
||||
/**
|
||||
* Removes a listener for a particular type of event. This will either
|
||||
* remove a specific listener, or all listeners for this type of event
|
||||
* @param event The event that we want to remove the listener of
|
||||
* @param fn The function to remove, or null if we want to remove all functions
|
||||
* @return This Socket
|
||||
*/
|
||||
removeListener( event: string, fn?: Function ): Socket;
|
||||
|
||||
/**
|
||||
* Removes all event listeners on this object
|
||||
* @return This Socket
|
||||
*/
|
||||
removeAllListeners( event?: string ): Socket;
|
||||
|
||||
/**
|
||||
* Sets the maximum number of listeners this instance can have
|
||||
* @param n The max number of listeners we can add to this emitter
|
||||
* @return This Socket
|
||||
*/
|
||||
setMaxListeners( n: number ): Socket;
|
||||
|
||||
/**
|
||||
* Returns all the callbacks for a particular event
|
||||
* @param event The event that we're looking for the callbacks of
|
||||
|
||||
Reference in New Issue
Block a user