NoSleep.js icon indicating copy to clipboard operation
NoSleep.js copied to clipboard

Prevent Sleep option

Open Merynek opened this issue 5 years ago • 1 comments

In my case i would like to prevent (system) sleep, not only screen. Is it possible to add parameter for ignore native wakelock (prevents only screen) and use only video element (prevents even system sleep) ?

Thank you.

Merynek avatar Jan 28 '21 10:01 Merynek

A workaround for this is to delete the wakeLock property from navigator, before you load the NoSleep.min.js script:

if ("wakeLock" in navigator) {
  delete Object.getPrototypeOf(window.navigator).wakeLock;
}

But I'd love a way to do this that isn't a hack.

WesleyAC avatar Apr 18 '21 05:04 WesleyAC