1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19

content / test / data / back_forward_cache / page_with_wakelock.html [blame]

<html>
  <title>WakeLock test</title>
</html>
<script>
let lock;
async function acquireWakeLock() {
  try {
    lock = await navigator.wakeLock.request('screen');
    return 'DONE';
  } catch (error) {
    return 'error: request failed';
  }
}

function wakeLockIsReleased() {
  return !lock || lock.released;
}

</script>