Github user daserge commented on a diff in the pull request: https://github.com/apache/cordova-plugin-battery-status/pull/42#discussion_r86942697 --- Diff: src/windows/BatteryProxy.js --- @@ -19,7 +19,38 @@ * */ -/* global WinJS, BatteryStatus */ +/* global Windows, WinJS, BatteryStatus */ + +var PowerManager = Windows && Windows.System && + Windows.System.Power && Windows.System.Power.PowerManager; + +if (PowerManager) { + var BatteryWin10 = { + start: function (win, fail) { + + function reportStatus() { + win({ + level: PowerManager.remainingChargePercent, + isPlugged: PowerManager.powerSupplyStatus !== Windows.System.Power.PowerSupplyStatus.notPresent + }, { keepCallback: true }); + } + + PowerManager.onremainingchargepercentchanged = reportStatus; --- End diff -- Would not it be better to use add/remove event listener here instead to avoid overriding a listener which might be set in an app code?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org