Power and Hardware Monitoring
Tap into native power and hardware events with Electron's powerMonitor module to build responsive, battery-aware desktop apps.
Apps That Sense Their Environment
Great native apps react to power and hardware state: pausing work on battery, saving before sleep, resuming on wake.
The powerMonitor Module
Electron's powerMonitor in the main process emits system power events and reports battery state.
const { powerMonitor } = require('electron');
app.whenReady().then(() => {
console.log(powerMonitor.getSystemIdleState(60));
});All lessons in this course
- Working with Native Modules
- Tray Applications & Badges
- Screen Capture and Media
- Power and Hardware Monitoring