ElectronNotification.once method
ElectronNotification › once
Unofficial
Registers a one-time event listener that is invoked when one of the notification's actions is activated.Signature:
once(event: "action", listener: (event: ElectronEvent, index: number) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "action" | The event name. |
| listener | (event: ElectronEvent, index: number) => void | The event handler receiving the event and the index of the activated action. |
Returns: this — This notification instance.
Unofficial
Registers a one-time event listener that is invoked when the notification is clicked by the user.Signature:
once(event: "click", listener: (event: ElectronEvent) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "click" | The event name. |
| listener | (event: ElectronEvent) => void | The event handler. |
Returns: this — This notification instance.
Unofficial
Registers a one-time event listener that is invoked when the notification is closed by manual intervention from the user.Signature:
once(event: "close", listener: (event: ElectronEvent) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "close" | The event name. |
| listener | (event: ElectronEvent) => void | The event handler. |
Returns: this — This notification instance.
Unofficial
Registers a one-time event listener that is invoked when an error is encountered while creating and showing the native notification.win32 only. Signature:
once(event: "failed", listener: (event: ElectronEvent, error: string) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "failed" | The event name. |
| listener | (event: ElectronEvent, error: string) => void | The event handler receiving the event and the error encountered during execution of the show() method. |
Returns: this — This notification instance.
Unofficial
Registers a one-time event listener that is invoked when the user clicks the "Reply" button on a notification withhasReply: true. darwin only. Signature:
once(event: "reply", listener: (event: ElectronEvent, reply: string) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "reply" | The event name. |
| listener | (event: ElectronEvent, reply: string) => void | The event handler receiving the event and the string the user entered into the inline reply field. |
Returns: this — This notification instance.
Unofficial
Registers a one-time event listener that is invoked when the notification is shown to the user.Signature:
once(event: "show", listener: (event: ElectronEvent) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "show" | The event name. |
| listener | (event: ElectronEvent) => void | The event handler. |
Returns: this — This notification instance.