1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-24 04:04:31 +00:00

Updated windows event hook for power state, to always event on hookup

This commit is contained in:
Bryan Roe
2020-05-31 11:14:26 -07:00
parent 1d81dba897
commit 6609e23f78
2 changed files with 2 additions and 5 deletions

View File

@@ -36,10 +36,7 @@ function powerMonitor()
this.on('newListener', function (name, callback)
{
if (process.platform != 'win32')
{ // Windows will already sends an initial event when you hookup the ACPI event, so this would be redundant
if (name == 'acdc') { callback.call(this, this._ACState == 1 ? 'AC' : 'BATTERY'); }
}
if (name == 'acdc') { callback.call(this, this._ACState == 1 ? 'AC' : 'BATTERY'); }
if (name == 'batteryLevel') { if (this._BatteryLevel >= 0) { callback.call(this, this._BatteryLevel); } }
});