12 lines
371 B
JavaScript
12 lines
371 B
JavaScript
|
|
// Low Battery Level
|
|
// Enable a developer to remove CPU intensive CSS/JS when battery is low
|
|
// developer.mozilla.org/en/DOM/window.navigator.mozBattery
|
|
// By: Paul Sayre
|
|
|
|
Modernizr.addTest('lowbattery', function () {
|
|
var minLevel = 0.20,
|
|
battery = Modernizr.prefixed('battery', navigator);
|
|
return !!(battery && !battery.charging && battery.level <= minLevel);
|
|
});
|