Getting Started
このプラグインのインストール手順と完全なマークダウンガイドを含むセットアップコマンドをコピーしてください。
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.
インストール
インストールAI-Assisted セットアップを使用してプラグインをインストールできます。次のコマンドを使用して、Capgo スキルをAIツールに追加します。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次のプロンプトを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-live-reload` plugin in my project.Manual セットアップを使用する場合は、次のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の説明を参照してください。
bun add @capgo/capacitor-live-reloadbunx cap syncインポート
「インポート」のセクションimport { LiveReload } from '@capgo/capacitor-live-reload';API の概要
APIの概要configureServer
__CAPGO_KEEP_0__の設定接続先の開発サーバー設定を保存して、以降の接続に使用します。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.configureServer({} as ConfigureServerOptions);connect
__CAPGO_KEEP_0__の接続既存のWebSocket接続がなければ、WebSocket接続を確立します。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.connect();disconnect
__CAPGO_KEEP_0__の切断現在のWebSocket接続を閉じて、自動再接続を無効化します。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.disconnect();getStatus
__CAPGO_KEEP_0__のステータス現在の接続状況を返します。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.getStatus();reload
「reload」セクションのタイトルCapacitor WebViewのフルリロードをトリガーします。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.reload();reloadFile
「reloadFile」セクションのタイトルランタイムがサポートする場合は、ファイル/モジュールを単一でリロードし、サポートしない場合はフルリロードにフォールバックします。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.reloadFile({} as FileUpdatePayload);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
「ライブリロードステータス」セクションのタイトルexport interface LiveReloadStatus { connected: boolean; url?: string;}FileUpdatePayload
ファイル更新ペイロードのセクションexport interface FileUpdatePayload { path: string; hash?: string;}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.ts. 公開 API がアップストリームで変更された場合、再度同期を実行してください。
Getting Started から続けてください
Getting Started から続けてくださいあなたが「を使用している場合 Getting Started から続けてください 計画用ダッシュボードと API の操作を計画する場合、を接続してください。 native capability を使用する場合、@capgo/capacitor-live-reload native capability を使用する場合、@capgo/capacitor-live-reload API の概要 API の実装詳細 概要 概要の実装詳細について API キー API キーの実装詳細について デバイス デバイスの実装詳細について