Empezar
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-live-reload`
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/live-reload/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-live-reloadbunx cap syncImportar
Sección titulada “Importar”import { LiveReload } from '@capgo/capacitor-live-reload';API Resumen
Sección titulada “API Resumen”configureServer
Sección titulada “configurar servidor”Almacena la configuración del servidor de desarrollo remoto para conexiones subsiguientes.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.configureServer({} as ConfigureServerOptions);connect
Sección titulada “conectar”Establish a WebSocket connection if one is not already active.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.connect();disconnect
Copiar a portapapelesSección titulada “desconectar”
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.disconnect();getStatus
Sección titulada “getStatus”Devuelve el estado de conexión actual.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.getStatus();Activar un recarga completa del WebView Capacitor.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.reload();reloadFile
Sección titulada “reloadFile”Recargar un archivo/módulo individual si el entorno de ejecución lo admite (cae en recarga completa).
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.reloadFile({} as FileUpdatePayload);Referencia de tipos
Sección titulada “Referencia de tipos”ConfigureServerOptions
Sección titulada “Configurar opciones del servidor”export interface ConfigureServerOptions { /** * Base URL for the dev server (e.g. https://dev.local:5173). * When a connection is established the Capacitor WebView navigates to this URL. */ url: string; /** Optional WebSocket path override when different from /ws. */ websocketPath?: string; /** Extra headers sent when creating the WebSocket connection. */ headers?: Record<string, string>; /** Automatically reconnect when the socket closes unexpectedly. Default: true. */ autoReconnect?: boolean; /** Delay (ms) between reconnection attempts. Default: 2000. */ reconnectInterval?: number;}LiveReloadStatus
Sección titulada “Estado de LiveReload”export interface LiveReloadStatus { connected: boolean; url?: string;}FileUpdatePayload
Sección titulada “Paquete de actualización de archivo”export interface FileUpdatePayload { path: string; hash?: string;}LiveReloadEventCallback
Sección titulada “Llamada de retorno de evento de LiveReload”export type LiveReloadEventCallback = (event: LiveReloadEventPayload) => void;LiveReloadStatusCallback
Sección titulada “Llamada de retorno de estado de LiveReload”export type LiveReloadStatusCallback = (status: LiveReloadStatus) => void;LiveReloadEventPayload
Sección titulada “Paquete de evento de LiveReload”export interface LiveReloadEventPayload { type: LiveReloadMessageType; /** Populated when type === 'file-update'. */ file?: FileUpdatePayload; /** Optional human-readable message for errors or status changes. */ message?: string;}LiveReloadMessageType
Sección titulada “Tipo de mensaje de LiveReload”export type LiveReloadMessageType = 'full-reload' | 'file-update' | 'error' | 'connected' | 'disconnected';Fuente de Verdad
Sección titulada “Fuente de Verdad”Esta página se genera a partir del plugin’s src/definitions.tsRe-ejecutar la sincronización cuando el público API cambie en la fuente.