EventEmitter Class — vite Architecture
Architecture documentation for the EventEmitter class in ws.d.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD ecd6d9fc_92e6_c3e5_41c7_f074559d2956["EventEmitter"] f807a74d_76fa_6b24_918f_7ef78a219c18["ws.d.ts"] ecd6d9fc_92e6_c3e5_41c7_f074559d2956 -->|defined in| f807a74d_76fa_6b24_918f_7ef78a219c18 46571ca7_09a6_731b_5751_ef1de54f0c07["constructor()"] ecd6d9fc_92e6_c3e5_41c7_f074559d2956 -->|method| 46571ca7_09a6_731b_5751_ef1de54f0c07 f1fa0e96_5b4a_07d5_9086_a5d3ac671644["close()"] ecd6d9fc_92e6_c3e5_41c7_f074559d2956 -->|method| f1fa0e96_5b4a_07d5_9086_a5d3ac671644 cde0ab27_7cc2_ff83_4fb3_bd704145d5de["ping()"] ecd6d9fc_92e6_c3e5_41c7_f074559d2956 -->|method| cde0ab27_7cc2_ff83_4fb3_bd704145d5de f36137de_738a_06a1_4211_7f19eb9529d2["pong()"] ecd6d9fc_92e6_c3e5_41c7_f074559d2956 -->|method| f36137de_738a_06a1_4211_7f19eb9529d2 19349950_d4e8_e10b_550f_aeca90d57c1a["send()"] ecd6d9fc_92e6_c3e5_41c7_f074559d2956 -->|method| 19349950_d4e8_e10b_550f_aeca90d57c1a 8921c81e_4f41_d2f8_7cba_cd961d39d8fc["terminate()"] ecd6d9fc_92e6_c3e5_41c7_f074559d2956 -->|method| 8921c81e_4f41_d2f8_7cba_cd961d39d8fc efe15ccf_8052_5509_78d1_80b7fad3db08["pause()"] ecd6d9fc_92e6_c3e5_41c7_f074559d2956 -->|method| efe15ccf_8052_5509_78d1_80b7fad3db08 6bce71a9_866d_6da2_6de3_7b997fcd3562["resume()"] ecd6d9fc_92e6_c3e5_41c7_f074559d2956 -->|method| 6bce71a9_866d_6da2_6de3_7b997fcd3562 11161406_fa42_1c03_d832_a1f3e4730a1b["addEventListener()"] ecd6d9fc_92e6_c3e5_41c7_f074559d2956 -->|method| 11161406_fa42_1c03_d832_a1f3e4730a1b ca7b0091_a2cc_dabe_7221_a6c2512778eb["removeEventListener()"] ecd6d9fc_92e6_c3e5_41c7_f074559d2956 -->|method| ca7b0091_a2cc_dabe_7221_a6c2512778eb 9565c0e8_8acc_a59f_f214_436577e22c34["on()"] ecd6d9fc_92e6_c3e5_41c7_f074559d2956 -->|method| 9565c0e8_8acc_a59f_f214_436577e22c34 2f0aba6c_569e_0901_3f6e_7017eecf64f2["once()"] ecd6d9fc_92e6_c3e5_41c7_f074559d2956 -->|method| 2f0aba6c_569e_0901_3f6e_7017eecf64f2 46955cbc_7c9e_4432_08cd_7b06f8abe700["off()"] ecd6d9fc_92e6_c3e5_41c7_f074559d2956 -->|method| 46955cbc_7c9e_4432_08cd_7b06f8abe700
Relationship Graph
Source Code
packages/vite/src/types/ws.d.ts lines 34–300
declare class WebSocket extends EventEmitter {
/** The connection is not yet open. */
static readonly CONNECTING: 0
/** The connection is open and ready to communicate. */
static readonly OPEN: 1
/** The connection is in the process of closing. */
static readonly CLOSING: 2
/** The connection is closed. */
static readonly CLOSED: 3
binaryType: 'nodebuffer' | 'arraybuffer' | 'fragments'
readonly bufferedAmount: number
readonly extensions: string
/** Indicates whether the websocket is paused */
readonly isPaused: boolean
readonly protocol: string
/** The current state of the connection */
readonly readyState:
| typeof WebSocket.CONNECTING
| typeof WebSocket.OPEN
| typeof WebSocket.CLOSING
| typeof WebSocket.CLOSED
readonly url: string
/** The connection is not yet open. */
readonly CONNECTING: 0
/** The connection is open and ready to communicate. */
readonly OPEN: 1
/** The connection is in the process of closing. */
readonly CLOSING: 2
/** The connection is closed. */
readonly CLOSED: 3
onopen: ((event: WebSocket.Event) => void) | null
onerror: ((event: WebSocket.ErrorEvent) => void) | null
onclose: ((event: WebSocket.CloseEvent) => void) | null
onmessage: ((event: WebSocket.MessageEvent) => void) | null
constructor(address: null)
constructor(
address: string | URL,
options?: WebSocket.ClientOptions | ClientRequestArgs,
)
constructor(
address: string | URL,
protocols?: string | string[],
options?: WebSocket.ClientOptions | ClientRequestArgs,
)
close(code?: number, data?: string | Buffer): void
ping(data?: any, mask?: boolean, cb?: (err: Error) => void): void
pong(data?: any, mask?: boolean, cb?: (err: Error) => void): void
send(data: any, cb?: (err?: Error) => void): void
send(
data: any,
options: {
mask?: boolean | undefined
binary?: boolean | undefined
compress?: boolean | undefined
fin?: boolean | undefined
},
cb?: (err?: Error) => void,
): void
terminate(): void
/**
* Pause the websocket causing it to stop emitting events. Some events can still be
* emitted after this is called, until all buffered data is consumed. This method
* is a noop if the ready state is `CONNECTING` or `CLOSED`.
*/
pause(): void
/**
* Make a paused socket resume emitting events. This method is a noop if the ready
* state is `CONNECTING` or `CLOSED`.
*/
resume(): void
// HTML5 WebSocket events
addEventListener(
method: 'message',
cb: (event: WebSocket.MessageEvent) => void,
Defined In
Source
Frequently Asked Questions
What is the EventEmitter class?
EventEmitter is a class in the vite codebase, defined in packages/vite/src/types/ws.d.ts.
Where is EventEmitter defined?
EventEmitter is defined in packages/vite/src/types/ws.d.ts at line 34.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free