navigator.getBattery().then((battery) => { console.log(battery.charging, battery.level); });
document.addEventListener('visibilitychange', (e) => console.log('visibilitychange', e, document.visibilityState), false);
// enable vibration support navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate; if (navigator.vibrate) { // vibration API supported navigator.vibrate(1000); // one second navigator.vibrate([500, 300, 100]); // one second pattern }
154800cookie-checkHTML API: Battery Status / Page visibility / Vibrate