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" | |
| 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" | |
| 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" | |
| 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" | |
| 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" | |
| 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" | |
| 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" | |
| 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" | |
| 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" | |
| listener | () => void | Callback invoked the next time the event is emitted. |
Returns: this — This PowerMonitor instance. Platform: darwin.