For the complete documentation index, see llms.txt. This page is also available as Markdown.

Screen.setAwakeMode

Functional API setScreenAwakeModeYou can use the same feature with it as well.

Feature description

Set the screen to stay always on, or turn it off. Useful when you need to keep the screen on continuously, such as for webtoons, videos, or reading documents.

enabledthe trueIf set to this value, the screen won't turn off, falseIf set this way, it will turn off according to the default screen saver timeout. Since it affects the entire app, if you want to use it only on a specific screen, please restore the previous state when leaving the screen.

Type

Screen.setAwakeMode(options: SetScreenAwakeModeOptions): Promise<{ enabled: boolean }>;

Params

interface SetScreenAwakeModeOptions {
  enabled: boolean;
}

Response

The applied state { enabled: boolean } is returned in this form.

Example code

import { Screen } from "@apps-in-toss/web-framework";

// Turn on always-on mode when entering the media content screen.
await Screen.setAwakeMode({ enabled: true });

// Restore the previous state when leaving the screen.
window.addEventListener("pagehide", () => {
  Screen.setAwakeMode({ enabled: false });
});

Was this helpful?