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-Assistedセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを使用してください:
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.この手順では、プラットフォーム固有の指示を参照してください。
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
セクション「sleepを許可する」sleepを許可する機能を無効にすることで、画面を暗くすることができます。
import { KeepAwake } from '@capgo/capacitor-keep-awake';
await KeepAwake.allowSleep();console.log('Screen can now dim');isSupported
セクション「サポートされているかどうか」現在のプラットフォームでsleepを許可する機能がサポートされているかどうかを確認します。
import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isSupported } = await KeepAwake.isSupported();if (isSupported) { console.log('Keep awake is supported');}isKeptAwake
セクション「sleepを許可しているかどうか」現在のデバイスがsleepを許可されているかどうかを確認します。
import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isKeptAwake } = await KeepAwake.isKeptAwake();console.log('Is kept awake:', isKeptAwake);型の参照
型の参照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.tspublic API のアップストリーム変更時に再度 Sync を実行してください。
Getting Started から続けて
セクション「Getting Started から続けて」Capgo を使用している場合 スタート APIのダッシュボードとAPIの運用を計画するために接続する @capgo/capacitor-keep-awakeを使用する @capgo/capacitor-keep-awakeを使用するnative機能の詳細 APIの概要 APIの概要の実装詳細 導入 導入の実装詳細 APIのキー APIのキーと実装詳細のデバイス デバイスの実装詳細. デバイスの実装詳細.