// Get the battery API
navigator.getBattery().then(function(battery) {
battery.addEventListener('chargingchange', function(){
console.log( 'New charging state: ', battery.charging );
});
battery.addEventListener('levelchange', function(){
console.log( 'New battery...