Electron powerMonitor 模块


本文整理自网络,侵删。

power-monitor模块是用来监听能源区改变的.只能在主进程中使用.在 app 模块的 ready 事件触发之后就不能使用这个模块了.

例如:

app.on('ready', function() {
  require('electron').powerMonitor.on('suspend', function() {
    console.log('The system is going to sleep');
  });
});

事件

power-monitor 模块可以触发下列事件:

Event: 'suspend'

在系统挂起的时候触发.

Event: 'resume'

在系统恢复继续工作的时候触发. Emitted when system is resuming.

Event: 'on-ac'

在系统使用交流电的时候触发. Emitted when the system changes to AC power.

Event: 'on-battery'

在系统使用电池电源的时候触发. Emitted when system changes to battery power.


标签:Electron

相关阅读 >>

Electron 离屏渲染

关于 Electron

Electron 支持的 chrome 命令行开关

Electron webframe 模块

Electron页内查找模块介绍(代码示例)

Electron 构建系统概览

Electron 源码目录结构

Electron 术语表

Electron powermonitor 模块

Electron 在线离线事件探测

更多相关阅读请进入《Electron》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...