Staijn1 / phos

Control your leds over wifi using a PWA Angular App
3 stars 0 forks source link

Implement wake lock on visualizer page #134

Closed Staijn1 closed 1 year ago

Staijn1 commented 1 year ago

Implement the screen wake lock API to prevent mobile phones to go to sleep when on the visualizer page

Staijn1 commented 1 year ago

Example code:

let wakeLock = null;

async function lockHandler() {
  wakeLock = await navigator.wakeLock.request("screen");
}

async function releaseHandler() {
  await wakeLock.release();
  wakeLock = null;
}