powerMonitor
监视电源状态的改变。
进程:主进程
事件
powerMonitor
模块触发以下事件:
Event: 'suspend'
在系统挂起时触发。
Event: 'resume'
在系统恢复时触发。
Event: 'on-ac' macOS Windows
当系统变为交流电源时触发。
Event: 'on-battery' macOS Windows
当系统更改为电池电量时触发。
Event: 'thermal-state-change' macOS
state
string - The system's new thermal state. Can beunknown
,nominal
,fair
,serious
,critical
.
Emitted when the thermal state of the system changes. Notification of a change in the thermal status of the system, such as entering a critical temperature range. Depending on the severity, the system might take steps to reduce said temperature, for example, throttling the CPU or switching on the fans if available.
Apps may react to the new state by reducing expensive computing tasks (e.g. video encoding), or notifying the user. The same state might be received repeatedly.
Event: 'speed-limit-change' macOS Windows
limit
number - The operating system's advertised speed limit for CPUs, in percent.
Notification of a change in the operating system's advertised speed limit for CPUs, in percent. Values below 100 indicate that the system is impairing processing power due to thermal management.
Event: 'shutdown' Linux macOS
当系统即将重启或关机时触发。 如果事件调用e.preventDefault()
, Electron 将会尝试延迟系统关机,以便 app 完全退出。 如果e.preventDefault()
被调用,在调用类似 app.quit()
后,app 会很快地退出。
Event: 'lock-screen' macOS Windows
当系统即将锁定屏幕时触发。
Event: 'unlock-screen' macOS Windows
当系统屏幕解锁,立即触发。
事件: 'user-did-groupe-active' macOS
当应用被激活时发出。 更多信息请访问 文档。
事件: 'user-did-resign-active' macOS
当应用被激活时发出。 更多信息请访问 文档。