battery-level.js 371 B

1234567891011
  1. // Low Battery Level
  2. // Enable a developer to remove CPU intensive CSS/JS when battery is low
  3. // developer.mozilla.org/en/DOM/window.navigator.mozBattery
  4. // By: Paul Sayre
  5. Modernizr.addTest('lowbattery', function () {
  6. var minLevel = 0.20,
  7. battery = Modernizr.prefixed('battery', navigator);
  8. return !!(battery && !battery.charging && battery.level <= minLevel);
  9. });