Skip to content

ElectronClientRequest.once method

ElectronClientRequest › once

Unofficial

Registers a one-time listener for the given request event.

Signature:

once(event: "abort", listener: (...args: unknown[]) => void): this

Parameters:

ParameterTypeDescription
event"abort"The event name.
listener(...args: unknown[]) => voidThe event handler.

Returns: thisThis ClientRequest instance.


Unofficial

Signature:

once(event: "close", listener: (...args: unknown[]) => void): this

Parameters:

ParameterTypeDescription
event"close"
listener(...args: unknown[]) => void

Returns: this


Unofficial

Signature:

once(event: "error", listener: (error: Error) => void): this

Parameters:

ParameterTypeDescription
event"error"
listener(error: Error) => void

Returns: this


Unofficial

Signature:

once(event: "finish", listener: (...args: unknown[]) => void): this

Parameters:

ParameterTypeDescription
event"finish"
listener(...args: unknown[]) => void

Returns: this


Unofficial

Signature:

once(event: "login", listener: (authInfo: ElectronAuthInfo, callback: (username?: string | undefined, password?: string | undefined) => void) => void): this

Parameters:

ParameterTypeDescription
event"login"
listener(authInfo: ElectronAuthInfo, callback: (username?: string | undefined, password?: string | undefined) => void) => void

Returns: this


Unofficial

Signature:

once(event: "redirect", listener: (statusCode: number, method: string, redirectUrl: string, responseHeaders: Record<string, string[]>) => void): this

Parameters:

ParameterTypeDescription
event"redirect"
listener(statusCode: number, method: string, redirectUrl: string, responseHeaders: Record<string, string[]>) => void

Returns: this


Unofficial

Signature:

once(event: "response", listener: (response: ElectronIncomingMessage) => void): this

Parameters:

ParameterTypeDescription
event"response"
listener(response: ElectronIncomingMessage) => void

Returns: this