Getting Started
Copia una línea de comando con los pasos de instalación y la guía 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”Puede utilizar nuestra configuración asistida por IA para instalar el plugin. Agregue las Capgo habilidades a su herramienta de IA utilizando el siguiente comando:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsLuego utilice la siguiente solicitud:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-live-reload` plugin in my project.Si prefiere la configuración manual, instale el plugin ejecutando los siguientes comandos y siguiendo las instrucciones específicas de la plataforma a continuación:
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 la configuración 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();Desencadena un recarga completa del Capacitor WebView.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.reload();reloadFile
Sección titulada “recargarArchivo”Recarga 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
Configuración de opciones del servidorexport 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
Estado de recarga en vivoexport 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”Esta página se genera desde el plugin’s src/definitions.ts. Re-ejecutar la sincronización cuando el API público cambie en la fuente.
Sigue adelante desde Getting Started
Sección titulada “Sigue adelante desde Getting Started”Si estás utilizando Getting Started para planificar las operaciones de panel de control y API, conecta con Usando @capgo/capacitor-live-reload para la capacidad nativa en Usando @capgo/capacitor-live-reload, API Overview para el detalle de implementación en API Overview, Introducción para el detalle de implementación en Introducción, API Claves para el detalle de implementación en API Claves, y Dispositivos para el detalle de implementación en Dispositivos.