ElectronPowerMonitor.once method
ElectronPowerMonitor › once
Unofficial
Adds a one-time listener for thelock-screen event. Signature:
once(event: "lock-screen", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "lock-screen" | The event name. |
| listener | () => void | Callback invoked the next time the event is emitted. |
Returns: this — This PowerMonitor instance. Platform: darwin,win32.
Unofficial
Adds a one-time listener for theon-ac event. Signature:
once(event: "on-ac", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "on-ac" | The event name. |
| listener | () => void | Callback invoked the next time the event is emitted. |
Returns: this — This PowerMonitor instance. Platform: darwin,win32.
Unofficial
Adds a one-time listener for theon-battery event. Signature:
once(event: "on-battery", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "on-battery" | The event name. |
| listener | () => void | Callback invoked the next time the event is emitted. |
Returns: this — This PowerMonitor instance. Platform: darwin.
Unofficial
Adds a one-time listener for theresume event. Signature:
once(event: "resume", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "resume" | The event name. |
| listener | () => void | Callback invoked the next time the event is emitted. |
Returns: this — This PowerMonitor instance.
Unofficial
Adds a one-time listener for theshutdown event. Signature:
once(event: "shutdown", listener: (event: ElectronEvent) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "shutdown" | The event name. |
| listener | (event: ElectronEvent) => void | Callback invoked the next time the event is emitted. |
Returns: this — This PowerMonitor instance. Platform: linux,darwin.
Unofficial
Adds a one-time listener for thesuspend event. Signature:
once(event: "suspend", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "suspend" | The event name. |
| listener | () => void | Callback invoked the next time the event is emitted. |
Returns: this — This PowerMonitor instance.
Unofficial
Adds a one-time listener for theunlock-screen event. Signature:
once(event: "unlock-screen", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "unlock-screen" | The event name. |
| listener | () => void | Callback invoked the next time the event is emitted. |
Returns: this — This PowerMonitor instance. Platform: darwin,win32.
Unofficial
Adds a one-time listener for theuser-did-become-active event. Signature:
once(event: "user-did-become-active", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "user-did-become-active" | The event name. |
| listener | () => void | Callback invoked the next time the event is emitted. |
Returns: this — This PowerMonitor instance. Platform: darwin.
Unofficial
Adds a one-time listener for theuser-did-resign-active event. Signature:
once(event: "user-did-resign-active", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| event | "user-did-resign-active" | The event name. |
| listener | () => void | Callback invoked the next time the event is emitted. |
Returns: this — This PowerMonitor instance. Platform: darwin.