Skip to content

Getting Started

GitHub

「インストール」のセクション

インストール
ターミナルウィンドウ
bun add @capgo/capacitor-keep-awake
bunx cap sync
import { KeepAwake } from '@capgo/capacitor-keep-awake';

画面を暗くしないようにする

import { KeepAwake } from '@capgo/capacitor-keep-awake';
await KeepAwake.keepAwake();
console.log('Screen will stay awake');

画面を暗くする (keep awake を無効にする)

import { KeepAwake } from '@capgo/capacitor-keep-awake';
await KeepAwake.allowSleep();
console.log('Screen can now dim');

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

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

現在、デバイスがキープアウェイクされているかどうかを確認します。

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

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から続けてください

Section titled “Getting Startedから続けてください”

Capgoを使用している場合 Getting StartedからDashboardと__CAPGO_KEEP_0__の計画と操作を開始するには、Capgoと接続してください to plan dashboard and API operations, connect it with Using @capgo/capacitor-keep-awake for the native capability in Using @capgo/capacitor-keep-awake, API Overview for the implementation detail in API Overview, Introduction for the implementation detail in Introduction, API Keys for the implementation detail in API Keys, and Devices for the implementation detail in Devices.