IEventEmitter interface

表示 Node.js中 net 模块中的 EventEmitter。 此接口支持框架,不应直接为代码调用。

方法

addListener(string | symbol, (args: any[]) => void)
emit(string | symbol, any[])
eventNames()
getMaxListeners()
listenerCount(string | symbol)
listeners(string | symbol)
off(string | symbol, (args: any[]) => void)
on(string | symbol, (args: any[]) => void)
once(string | symbol, (args: any[]) => void)
prependListener(string | symbol, (args: any[]) => void)
prependOnceListener(string | symbol, (args: any[]) => void)
rawListeners(string | symbol)
removeAllListeners(string | symbol)
removeListener(string | symbol, (args: any[]) => void)
setMaxListeners(number)

方法详细信息

addListener(string | symbol, (args: any[]) => void)

function addListener(event: string | symbol, listener: (args: any[]) => void): this

参数

event

string | symbol

listener

(args: any[]) => void

返回

this

emit(string | symbol, any[])

function emit(event: string | symbol, args: any[]): boolean

参数

event

string | symbol

args

any[]

返回

boolean

eventNames()

function eventNames(): Array<string | symbol>

返回

Array<string | symbol>

getMaxListeners()

function getMaxListeners(): number

返回

number

listenerCount(string | symbol)

function listenerCount(type: string | symbol): number

参数

type

string | symbol

返回

number

listeners(string | symbol)

function listeners(event: string | symbol): Function[]

参数

event

string | symbol

返回

Function[]

off(string | symbol, (args: any[]) => void)

function off(event: string | symbol, listener: (args: any[]) => void): this

参数

event

string | symbol

listener

(args: any[]) => void

返回

this

on(string | symbol, (args: any[]) => void)

function on(event: string | symbol, listener: (args: any[]) => void): this

参数

event

string | symbol

listener

(args: any[]) => void

返回

this

once(string | symbol, (args: any[]) => void)

function once(event: string | symbol, listener: (args: any[]) => void): this

参数

event

string | symbol

listener

(args: any[]) => void

返回

this

prependListener(string | symbol, (args: any[]) => void)

function prependListener(event: string | symbol, listener: (args: any[]) => void): this

参数

event

string | symbol

listener

(args: any[]) => void

返回

this

prependOnceListener(string | symbol, (args: any[]) => void)

function prependOnceListener(event: string | symbol, listener: (args: any[]) => void): this

参数

event

string | symbol

listener

(args: any[]) => void

返回

this

rawListeners(string | symbol)

function rawListeners(event: string | symbol): Function[]

参数

event

string | symbol

返回

Function[]

removeAllListeners(string | symbol)

function removeAllListeners(event?: string | symbol): this

参数

event

string | symbol

返回

this

removeListener(string | symbol, (args: any[]) => void)

function removeListener(event: string | symbol, listener: (args: any[]) => void): this

参数

event

string | symbol

listener

(args: any[]) => void

返回

this

setMaxListeners(number)

function setMaxListeners(n: number): this

参数

n

number

返回

this