# powerMonitor
`power-monitor`模塊是用來監聽能源區改變的.只能在主進程中使用.在 `app` 模塊的 `ready` 事件觸發之后就不能使用這個模塊了.
例如:
```javascript
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 常見問題
- 向導
- 支持平臺
- 分發應用
- 提交應用到 Mac App Store
- 打包應用
- 使用 Node 原生模塊
- 主進程調試
- 使用 Selenium 和 WebDriver
- 使用開發人員工具擴展
- 使用 Pepper Flash 插件
- 使用 Widevine CDM 插件
- 教程
- 快速入門
- 桌面環境集成
- 在線/離線事件探測
- API文檔
- 簡介
- 進程對象
- 支持的 Chrome 命令行開關
- 環境變量
- 自定義的 DOM 元素
- File 對象
- <webview> 標簽
- window.open 函數
- 在主進程內可用的模塊
- app
- autoUpdater
- BrowserWindow
- contentTracing
- dialog
- globalShortcut
- ipcMain
- Menu
- MenuItem
- powerMonitor
- powerSaveBlocker
- protocol
- session
- webContents
- Tray
- 在渲染進程(網頁)內可用的模塊
- desktopCapturer
- ipcRenderer
- remote
- webFrame
- 在兩種進程中都可用的模塊
- clipboard
- crashReporter
- nativeImage
- screen
- shell
- 開發
- 代碼規范
- 源碼目錄結構
- 與 NW.js(原 node-webkit)在技術上的差異
- 構建系統概覽
- 構建步驟(OS X)
- 構建步驟(Windows)
- 構建步驟(Linux)
- 在調試中使用 Symbol Server