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:
@@ -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); } }
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user