Iniziare
Copia un prompt di configurazione con i passaggi di installazione e la guida markdown completa per questo plugin.
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.
Installazione
Sezione intitolata “Installazione”Puoi utilizzare la nostra configurazione assistita da AI per installare il plugin. Aggiungi le Capgo abilità al tuo strumento AI utilizzando il seguente comando:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsUsa poi il seguente prompt:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-keep-awake` plugin in my project.Se preferisci la configurazione Manuale, installa il plugin eseguendo i seguenti comandi e segui le istruzioni specifiche del tuo platform:
bun add @capgo/capacitor-keep-awakebunx cap syncImportazione
Sezione intitolata “Importazione”import { KeepAwake } from '@capgo/capacitor-keep-awake';API Panoramica
Sezione intitolata “API Panoramica”keepAwake
Sezione intitolata “keepAwake”Prevenire che lo schermo del dispositivo si spegni.
import { KeepAwake } from '@capgo/capacitor-keep-awake';
await KeepAwake.keepAwake();console.log('Screen will stay awake');allowSleep
Sezione intitolata “allowSleep”Consenti al dispositivo di spegnere lo schermo (disabilita keep awake).
import { KeepAwake } from '@capgo/capacitor-keep-awake';
await KeepAwake.allowSleep();console.log('Screen can now dim');isSupported
Sezione intitolata “isSupported”Verifica se il keep awake è supportato sulle attuali piattaforme.
import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isSupported } = await KeepAwake.isSupported();if (isSupported) { console.log('Keep awake is supported');}isKeptAwake
Sezione intitolata “isKeptAwake”Verifica se il dispositivo è attualmente tenuto sveglio.
import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isKeptAwake } = await KeepAwake.isKeptAwake();console.log('Is kept awake:', isKeptAwake);Riferimento di tipo
Sezione intitolata “Type Reference”IsSupportedResult
Sezione intitolata “IsSupportedResult”Risultato del metodo isSupported().
export interface IsSupportedResult { /** * Whether keep awake is supported on the current platform. * * @since 1.0.0 */ isSupported: boolean;}IsKeptAwakeResult
Sezione intitolata “IsKeptAwakeResult”Risultato del metodo isKeptAwake().
export interface IsKeptAwakeResult { /** * Whether the device is currently being kept awake. * * @since 1.0.0 */ isKeptAwake: boolean;}Fonte di Verità
Sezione intitolata “Fonte di Verità”Questa pagina è generata dal plugin’s src/definitions.tsRiepilogare la sincronizzazione quando le informazioni pubbliche API cambiano in modo upstream.
Continua da Inizia a utilizzare
Se stai utilizzandoInizia a utilizzare per pianificare il dashboard e le __CAPGO_KEEP_0__ operazioni, connettilo con Utilizza @API/__CAPGO_KEEP_1__-keep-awake per la capacità nativa in Utilizza @capgo/capacitor-keep-awake Utilizza @capgo/capacitor-keep-awake API Panoramica per i dettagli di implementazione in API Panoramica, Introduzione per i dettagli di implementazione in Introduzione, API Chiavi per i dettagli di implementazione in API Chiavi, e Dispositivi per i dettagli di implementazione in Dispositivi.