Live Reload __CAPGO_KEEP_0__ リポジトリ
このプラグインのインストール手順と全体のマークダウン ガイドを含むセットアップ コマンドをコピーできます。
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.
インストール
「インストール」のセクションCapgo の AI アシスト セットアップを使用してプラグインをインストールできます。AI ツールに Capgo スキルを追加するには、以下のコマンドを実行してください。
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';APIの概要
セクション「APIの概要」configureServer
configureServer以降の接続に使用するリモート開発サーバーの設定を保存します。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.configureServer({} as ConfigureServerOptions);connect
接続既存のWebSocket接続がなければ、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 ウェブビューのフル再読み込みをトリガーします。
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.reload();クリップボードにコピー
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
FileUpdatePayloadのセクションexport interface FileUpdatePayload { path: string; hash?: string;}LiveReloadEventCallback
LiveReloadEventCallbackのセクションexport type LiveReloadEventCallback = (event: LiveReloadEventPayload) => void;LiveReloadStatusCallback
LiveReloadStatusCallbackのセクションexport type LiveReloadStatusCallback = (status: LiveReloadStatus) => void;LiveReloadEventPayload
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
LiveReloadMessageTypeのセクションexport type LiveReloadMessageType = 'full-reload' | 'file-update' | 'error' | 'connected' | 'disconnected';真実の源
__CAPGO_KEEP_0__このページはプラグインから生成されています。 src/definitions.ts. upstream の API が変更された場合に、再度 Sync を実行してください。
Getting Started から続けてください。
Getting Started から続けてください。Capacitor を使用している場合、 Getting Started ダッシュボードと API の作業を計画するには、 Capacitor を使用して @capgo/capacitor-live-reload Capacitor を使用して @capgo/capacitor-live-reload Capacitor の API の概要 Capacitor の API の実装詳細 Capacitor の導入 導入の実装詳細について API キー API キーに関する実装詳細について、 デバイス デバイスに関する実装詳細について。