はじめに
このプラグインのインストール手順とフルマークダウンガイドを含むセットアッププロンプトをコピーします。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-keep-awake`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/keep-awake/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
「インストール」のセクションbun add @capgo/capacitor-keep-awakebunx cap syncインポート
「インポート」セクションimport { KeepAwake } from '@capgo/capacitor-keep-awake';API オーバービュー
「API オーバービュー」セクションkeepAwake
「keepAwake」セクション画面の暗幕を防止します。
import { KeepAwake } from '@capgo/capacitor-keep-awake';
await KeepAwake.keepAwake();console.log('Screen will stay awake');allowSleep
「allowSleep」セクション画面の暗幕を許可します (keep awake を無効)。
import { KeepAwake } from '@capgo/capacitor-keep-awake';
await KeepAwake.allowSleep();console.log('Screen can now dim');isSupported
「isSupported」セクション__CAPGO_KEEP_0__の機能が現在のプラットフォームでサポートされているかどうかを確認します。
import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isSupported } = await KeepAwake.isSupported();if (isSupported) { console.log('Keep awake is supported');}isKeptAwake
isKeptAwake__CAPGO_KEEP_2__が現在実行されているかどうかを確認します。
import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isKeptAwake } = await KeepAwake.isKeptAwake();console.log('Is kept awake:', isKeptAwake);Type Reference
__CAPGO_KEEP_4__IsSupportedResult
IsSupportedResultisSupported()メソッドの結果です。
export interface IsSupportedResult { /** * Whether keep awake is supported on the current platform. * * @since 1.0.0 */ isSupported: boolean;}IsKeptAwakeResult
Type Reference__CAPGO_KEEP_6__の結果です。
export interface IsKeptAwakeResult { /** * Whether the device is currently being kept awake. * * @since 1.0.0 */ isKeptAwake: boolean;}真実の源
「真実の源」というセクションこのページはプラグインの src/definitions.ts公開 API がアップストリームで変更された場合に再度同期を実行してください。