Skip to content

Session.once method

Session › once

Unofficial

Emitted after an extension is loaded.

Signature:

once(event: "extension-loaded", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this

Parameters:

Parameter Type Description
event "extension-loaded"
listener (event: ElectronEvent, extension: ElectronExtension) => void

Returns: this


Unofficial

Emitted after an extension is loaded and all necessary browser state is initialized.

Signature:

once(event: "extension-ready", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this

Parameters:

Parameter Type Description
event "extension-ready"
listener (event: ElectronEvent, extension: ElectronExtension) => void

Returns: this


Unofficial

Emitted after an extension is unloaded.

Signature:

once(event: "extension-unloaded", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this

Parameters:

Parameter Type Description
event "extension-unloaded"
listener (event: ElectronEvent, extension: ElectronExtension) => void

Returns: this


Unofficial

Emitted when a new HID device becomes available.

Signature:

once(event: "hid-device-added", listener: (event: ElectronEvent, details: ElectronHidDeviceAddedDetails) => void): this

Parameters:

Parameter Type Description
event "hid-device-added"
listener (event: ElectronEvent, details: ElectronHidDeviceAddedDetails) => void

Returns: this


Unofficial

Emitted when a HID device has been removed.

Signature:

once(event: "hid-device-removed", listener: (event: ElectronEvent, details: ElectronHidDeviceRemovedDetails) => void): this

Parameters:

Parameter Type Description
event "hid-device-removed"
listener (event: ElectronEvent, details: ElectronHidDeviceRemovedDetails) => void

Returns: this


Unofficial

Emitted when a render process requests preconnection to a URL.

Signature:

once(event: "preconnect", listener: (event: ElectronEvent, preconnectUrl: string, allowCredentials: boolean) => void): this

Parameters:

Parameter Type Description
event "preconnect"
listener (event: ElectronEvent, preconnectUrl: string, allowCredentials: boolean) => void

Returns: this


Unofficial

Emitted when a HID device needs to be selected.

Signature:

once(event: "select-hid-device", listener: (event: ElectronEvent, details: ElectronSelectHidDeviceDetails, callback: (deviceId?: string | null | undefined) => void) => void): this

Parameters:

Parameter Type Description
event "select-hid-device"
listener (event: ElectronEvent, details: ElectronSelectHidDeviceDetails, callback: (deviceId?: string | null | undefined) => void) => void

Returns: this


Unofficial

Emitted when a serial port needs to be selected.

Signature:

once(event: "select-serial-port", listener: (event: ElectronEvent, portList: ElectronSerialPort[], webContents: ElectronWebContents, callback: (portId: string) => void) => void): this

Parameters:

Parameter Type Description
event "select-serial-port"
listener (event: ElectronEvent, portList: ElectronSerialPort[], webContents: ElectronWebContents, callback: (portId: string) => void) => void

Returns: this


Unofficial

Emitted after a new serial port becomes available.

Signature:

once(event: "serial-port-added", listener: (event: ElectronEvent, port: ElectronSerialPort, webContents: ElectronWebContents) => void): this

Parameters:

Parameter Type Description
event "serial-port-added"
listener (event: ElectronEvent, port: ElectronSerialPort, webContents: ElectronWebContents) => void

Returns: this


Unofficial

Emitted after a serial port has been removed.

Signature:

once(event: "serial-port-removed", listener: (event: ElectronEvent, port: ElectronSerialPort, webContents: ElectronWebContents) => void): this

Parameters:

Parameter Type Description
event "serial-port-removed"
listener (event: ElectronEvent, port: ElectronSerialPort, webContents: ElectronWebContents) => void

Returns: this


Unofficial

Emitted when a hunspell dictionary file starts downloading.

Signature:

once(event: "spellcheck-dictionary-download-begin", listener: (event: ElectronEvent, languageCode: string) => void): this

Parameters:

Parameter Type Description
event "spellcheck-dictionary-download-begin"
listener (event: ElectronEvent, languageCode: string) => void

Returns: this


Unofficial

Emitted when a hunspell dictionary file download fails.

Signature:

once(event: "spellcheck-dictionary-download-failure", listener: (event: ElectronEvent, languageCode: string) => void): this

Parameters:

Parameter Type Description
event "spellcheck-dictionary-download-failure"
listener (event: ElectronEvent, languageCode: string) => void

Returns: this


Unofficial

Emitted when a hunspell dictionary file has been successfully downloaded.

Signature:

once(event: "spellcheck-dictionary-download-success", listener: (event: ElectronEvent, languageCode: string) => void): this

Parameters:

Parameter Type Description
event "spellcheck-dictionary-download-success"
listener (event: ElectronEvent, languageCode: string) => void

Returns: this


Unofficial

Emitted when a hunspell dictionary file has been successfully initialized.

Signature:

once(event: "spellcheck-dictionary-initialized", listener: (event: ElectronEvent, languageCode: string) => void): this

Parameters:

Parameter Type Description
event "spellcheck-dictionary-initialized"
listener (event: ElectronEvent, languageCode: string) => void

Returns: this


Unofficial

Emitted when Electron is about to download item in webContents.

Signature:

once(event: "will-download", listener: (event: ElectronEvent, item: ElectronDownloadItem, webContents: ElectronWebContents) => void): this

Parameters:

Parameter Type Description
event "will-download"
listener (event: ElectronEvent, item: ElectronDownloadItem, webContents: ElectronWebContents) => void

Returns: this