Iniciación
Copiar un prompt de configuración con los pasos de instalación y la guía de markdown completa para este 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.
Instalar
Sección titulada “Instalar”bun add @capgo/capacitor-keep-awakebunx cap syncImportar
Sección titulada “Importar”import { KeepAwake } from '@capgo/capacitor-keep-awake';API Resumen
Sección titulada “API Resumen”keepAwake
Sección titulada “keepAwake”Evita que el dispositivo reduzca la intensidad de la pantalla.
import { KeepAwake } from '@capgo/capacitor-keep-awake';
await KeepAwake.keepAwake();console.log('Screen will stay awake');allowSleep
Sección titulada “allowSleep”Permite que el dispositivo reduzca la intensidad de la pantalla (desactiva keep awake).
import { KeepAwake } from '@capgo/capacitor-keep-awake';
await KeepAwake.allowSleep();console.log('Screen can now dim');isSupported
Sección titulada “isSupported”Verificar si el función de mantenerse despierto está soportada en la plataforma actual.
import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isSupported } = await KeepAwake.isSupported();if (isSupported) { console.log('Keep awake is supported');}isKeptAwake
Sección titulada “isKeptAwake”Verificar si el dispositivo está actualmente siendo mantenido despierto.
import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isKeptAwake } = await KeepAwake.isKeptAwake();console.log('Is kept awake:', isKeptAwake);Referencia de tipo
Sección titulada “Referencia de tipo”IsSupportedResult
Sección titulada “IsSupportedResult”Resultado del método isSupported().
export interface IsSupportedResult { /** * Whether keep awake is supported on the current platform. * * @since 1.0.0 */ isSupported: boolean;}IsKeptAwakeResult
Sección titulada “IsKeptAwakeResult”Resultado del método isKeptAwake().
export interface IsKeptAwakeResult { /** * Whether the device is currently being kept awake. * * @since 1.0.0 */ isKeptAwake: boolean;}Fuente de Verdad
Sección titulada “Fuente de Verdad”Esta página se genera a partir del plugin’s src/definitions.tsRe-ruta la sincronización cuando el público API cambia en la fuente.