コンテンツにジャンプ

Getting Started

GitHub

AI-Assisted セットアップを使用してプラグインをインストールできます。次のコマンドを使用して、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 セットアップを使用する場合は、次のコマンドを実行して、以下のプラットフォーム固有の指示に従ってください。

ターミナルウィンドウ
bun add @capgo/capacitor-keep-awake
bunx 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

現在のプラットフォームでkeep awake機能がサポートされているかどうかを確認します。

import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isSupported } = await KeepAwake.isSupported();
if (isSupported) {
console.log('Keep awake is supported');
}

isKeptAwake

isKeptAwake

現在、デバイスがkeep awakeされているかどうかを確認します。

import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isKeptAwake } = await KeepAwake.isKeptAwake();
console.log('Is kept awake:', isKeptAwake);

サポートされているかどうかの結果

export interface IsSupportedResult {
/**
* Whether keep awake is supported on the current platform.
*
* @since 1.0.0
*/
isSupported: boolean;
}

キープアウェイクされているかどうかの結果

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 を接続してください。 Using @capgo/capacitor-keep-awake Using @capgo/capacitor-keep-awake API Overview API Overview Introduction Introduction API キー 実装詳細については、API キーと デバイス 実装詳細については、デバイスと