Inicio
Copie 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 “configureServer”Almacena los ajustes del servidor de desarrollo remoto para conexiones posteriores.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.configureServer({} as ConfigureServerOptions);connect
Sección titulada “connect”Establish a WebSocket connection if one is not already active.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.connect();disconnect
Sección titulada “disconnect”Close the current WebSocket connection and disable auto reconnect.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.disconnect();getStatus
Sección titulada “getStatus”Returns the current connection status.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.getStatus();Disparar un recarga completa del Capacitor WebView.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.reload();reloadFile
Sección titulada “recargarArchivo”Recargar un archivo/módulo individual si el tiempo 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 “ConfigurarOpcionesServidor”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 “EstadoDeRecargaEnVivo”export interface LiveReloadStatus { connected: boolean; url?: string;}FileUpdatePayload
Sección titulada “FileUpdatePayload”export interface FileUpdatePayload { path: string; hash?: string;}LiveReloadEventCallback
Sección titulada “LiveReloadEventCallback”export type LiveReloadEventCallback = (event: LiveReloadEventPayload) => void;LiveReloadStatusCallback
Sección titulada “LiveReloadStatusCallback”export type LiveReloadStatusCallback = (status: LiveReloadStatus) => void;LiveReloadEventPayload
Sección titulada “LiveReloadEventPayload”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 “LiveReloadMessageType”export type LiveReloadMessageType = 'full-reload' | 'file-update' | 'error' | 'connected' | 'disconnected';Fuente de Verdad
Sección titulada “Fuente de Verdad”This page is generated from the plugin’s src/definitions.tsRe-ejecuta la sincronización cuando los archivos públicos API cambian en la fuente.
Sigue adelante desde Inicio
Sección titulada “Sigue adelante desde Inicio”Si estás utilizando Inicio para planificar operaciones de panel de control y API, conecta con Usando @capgo/capacitor-live-reload para la capacidad nativa en Usando @capgo/capacitor-live-reload, Resumen de API para el detalle de implementación en Resumen de API Introducción para los detalles de implementación en Introducción, API Claves para los detalles de implementación en API Claves, y Dispositivos para los detalles de implementación en Dispositivos.