电源监视器

    进程:主进程

    This module cannot be used until the ready event of the app module is emitted.

    例如:

    powerMonitor 模块触发以下事件:

    Event: ‘resume’

    在系统恢复时触发。

    Event: ‘on-ac’ Windows

    当系统变为交流电源时触发。

    当系统更改为电池电量时触发。

    Event: ‘shutdown’ Linux macOS

    当系统即将重启或关机时出发 如果事件调用e.preventDefault(), Electron 将会尝试延迟系统关机,以便 app 完全退出。 如果被调用,在调用类似 app.quit() 后,app 会很快地退出。

    Event: ‘lock-screen’ macOS Windows

    当系统屏幕解锁,立即触发。

    方法

    电源监视器 模块具有以下方法:

    powerMonitor.getSystemIdleState(idleThreshold)

    Returns String - The system’s current state. Can be , idle, locked or unknown.

    Calculate the system idle state. idleThreshold is the amount of time (in seconds) before considered idle. locked is available on supported systems only.

    计算系统空闲时间以秒为单位。