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.
インストール
「インストール」のセクションYou can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:
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 Setupを選択した場合、以下のコマンドを実行し、下記のプラットフォーム固有の説明を参照してください。
bun add @capgo/capacitor-live-reloadbunx cap syncインポート
「インポート」のセクションimport { LiveReload } from '@capgo/capacitor-live-reload';configureServer
Section titled “サーバー設定”__CAPGO_KEEP_0__サーバー設定を使用しての後続の接続に使用します。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.configureServer({} as ConfigureServerOptions);connect
Section titled “接続”既存の接続がなければ、WebSocket接続を確立します。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.connect();disconnect
Section titled “切断”現在のWebSocket接続を閉じて、自動再接続を無効化します。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.disconnect();getStatus
Section titled “接続状況”現在の接続状況を返します。
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';真実の源
Source Of Truthプラグインの生成元 src/definitions.tspublic API の変更を検知したときに再度syncを実行してください
Getting Started から続けて
Getting Started から続けてCapgoを使用している場合 Getting Started から続けて、ダッシュボードと __CAPGO_KEEP_0__ の作業を計画するには、Capgoを接続してください @API/__CAPGO_KEEP_1__-live-reload を使用 @capgo/capacitor-live-reload のnative capabilityの実装については、@capgo/capacitor-live-reload を参照してください for the native capability in Using @capgo/capacitor-live-reload, API の実装詳細については、API の概要を参照してください. API の概要 __CAPGO_KEEP_0__ Introductionの実装詳細について API Keys API Keysの実装詳細について、 Devices Devicesの実装詳細について