はじめに
このプラグインのインストールステップとフルマークダウンガイドの全てのステップを含む設定の質問をコピーする。
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.
Install
インストールbun add @capgo/capacitor-live-reloadbunx cap syncImport
インポートimport { LiveReload } from '@capgo/capacitor-live-reload';API オーバービュー
API オーバービューconfigureServer
configureServer接続先の開発サーバー設定を保存します。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.configureServer({} as ConfigureServerOptions);connect
接続既存の接続がなければWebSocket接続を確立します。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.connect();disconnect
切断現在のWebSocket接続を閉じ、自動再接続を無効化します。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.disconnect();getStatus
ステータス取得現在の接続状態を取得します。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.getStatus();reload
再読み込みCapacitor WebViewを完全に再読み込みします。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.reload();reloadFile
Section titled “reloadFile”ファイルの再読み込み (サポートされている場合、全体の再読み込みにフォールバックします)
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.reloadFile({} as FileUpdatePayload);ConfigureServerOptions
Section titled “ConfigureServerOptions”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
Section titled “LiveReloadStatus”export interface LiveReloadStatus { connected: boolean; url?: string;}FileUpdatePayload
Section titled “FileUpdatePayload”export interface FileUpdatePayload { path: string; hash?: string;}LiveReloadEventCallback
Section titled “LiveReloadEventCallback”export type LiveReloadEventCallback = (event: LiveReloadEventPayload) => void;LiveReloadStatusCallback
セクション「ライブリロードステータスコールバック」export type LiveReloadStatusCallback = (status: LiveReloadStatus) => void;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
セクション「ライブリロードメッセージタイプ」export type LiveReloadMessageType = 'full-reload' | 'file-update' | 'error' | 'connected' | 'disconnected';真実の源
セクション「真実の源」このページはプラグインの src/definitions.tsAPIがアップストリームで変更された場合に、パブリックを再度同步してください。
Getting Startedから続けてください
「Getting Started」から続けてあなたは「を使用しています Getting Started APIとダッシュボードの計画、APIの操作を接続する場合 capgo/capacitor-live-reloadを使用する capgo/capacitor-live-reloadのネイティブ機能の使用 APIの概要 APIの実装詳細 Introduction 実装詳細 API Keys APIの実装詳細 デバイス デバイスの実装詳細について