Getting Started
このプラグインのインストールステップとフルマークダウンガイドのセットアッププロンプトをコピーする。
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.
インストール
「インストール」のセクションCapgoのAIアシストセットアップを使用してプラグインをインストールできます。次のコマンドを使用して、CapgoスキルをAIツールに追加します。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次のプロンプトを使用してください:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-keep-awake` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行して、下記のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-keep-awakebunx cap syncImport
「Import」のセクション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現在のプラットフォームでkeep awake機能がサポートされているかどうかを確認する
import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isSupported } = await KeepAwake.isSupported();if (isSupported) { console.log('Keep awake is supported');}isKeptAwake
isKeptAwake現在、画面を暗くしないようにしているかどうかを確認する
import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isKeptAwake } = await KeepAwake.isKeptAwake();console.log('Is kept awake:', isKeptAwake);型リファレンス
「型リファレンス」のセクションIsSupportedResult
「IsSupportedResult」のセクションisSupported()メソッドの結果
export interface IsSupportedResult { /** * Whether keep awake is supported on the current platform. * * @since 1.0.0 */ isSupported: boolean;}IsKeptAwakeResult
「IsKeptAwakeResult」のセクションisKeptAwake()メソッドの結果
export interface IsKeptAwakeResult { /** * Whether the device is currently being kept awake. * * @since 1.0.0 */ isKeptAwake: boolean;}真実の源
「真実の源」のセクションこのページはプラグインのソースコードから自動生成されています src/definitions.ts. API をアップストリームで変更した場合、再度 Sync を実行してください。
Getting Started から続けてください。
Getting Started から続けてください。あなたが使用している場合 Getting Started API の操作とダッシュボードの計画を行うために、API を __CAPGO_KEEP_1__ に接続してください。 Using @capgo/capacitor-keep-awake Using @capgo/capacitor-keep-awake API Overview API Overview Introduction Introduction API キー 実装詳細については、API キーを参照してください。 デバイス 実装詳細については、デバイスを参照してください。