1681-engine / mobile / keepScreenOn
Function: keepScreenOn() ​
ts
function keepScreenOn(wakeLock?, doc?): Promise<() => void>;Defined in: src/mobile/screen.ts:39
Keeps the screen on while the game runs (a phone dims and locks during a cut scene or a long think otherwise), through the Screen Wake Lock API. The browser drops the lock whenever the page is hidden, so it is asked for again each time the page comes back. Resolves to the release; does nothing where the API is missing or refuses.
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
wakeLock | WakeLockLike | undefined | ... |
doc | | Pick<Document, "addEventListener" | "removeEventListener" | "visibilityState"> | undefined | globalThis.document |
Returns ​
Promise<() => void>