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:

Parameter Type Description
event "abort" The event name.
listener (...args: unknown[]) => void The event handler.

Returns: thisThis ClientRequest instance.


Unofficial

Signature:

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

Parameters:

Parameter Type Description
event "close"
listener (...args: unknown[]) => void

Returns: this


Unofficial

Signature:

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

Parameters:

Parameter Type Description
event "error"
listener (error: Error) => void

Returns: this


Unofficial

Signature:

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

Parameters:

Parameter Type Description
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:

Parameter Type Description
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:

Parameter Type Description
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:

Parameter Type Description
event "response"
listener (response: ElectronIncomingMessage) => void

Returns: this