const requestWakeLock = async () => {
try {
const wakeLock = await navigator.wakeLock.request("screen");
} catch (err) {
// The wake lock request fails - usually system-related, such as low battery.
console.log(`${err.name}, ${err.message}`);
}
};
requestWakeLock();WakeLock: request() method / notebook
WakeLock: request() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.