navigator.battery
只读属性:
- charging
电池是否在充电,返回Boolean
- chargingTime
电池到全部充满咳需要多少秒,0表示充满了
- dischargingTime
电池还剩下多少时间消耗完。
- level
系统的电池电量级别,从0.0到1.0
事件:
- chargingchange
- chargingtimechange
- dischargingtimechange
- levelchange
扩展阅读:
https://developer.mozilla.org/en-US/docs/DOM/window.navigator.battery
http://www.oschina.net/translate/introducing-the-battery-status-api?cmp
http://www.w3.org/TR/battery-status/
https://github.com/pstadler/battery.js 插件