スタートガイド
インストール手順と、このプラグインの完全なMarkdownガイドを含むセットアッププロンプトをコピーします。
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」セクションAIアシストによるセットアップを使用してプラグインをインストールできます。次のコマンドを使用して、お使いのAIツールに Capgo のスキルを追加してください:
bunx 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.手動でのセットアップを行う場合は、以下のコマンドを実行してプラグインをインストールし、各プラットフォームごとの手順に従ってください:
bun add @capgo/capacitor-live-reloadbunx cap syncインポート
「Import」セクションimport { LiveReload } from '@capgo/capacitor-live-reload';クイックスタート
「Quick start」セクションimport { LiveReload } from '@capgo/capacitor-live-reload';
const result = await LiveReload.configureServer({ url: 'https://example.com' });console.log(result);例:connect
「Example: connect」セクションimport { LiveReload } from '@capgo/capacitor-live-reload';
const result = await LiveReload.connect();console.log(result);import { LiveReload } from '@capgo/capacitor-live-reload';
const result = await LiveReload.disconnect();console.log(result);よくある落とし穴
「よくある落とし穴」というタイトルのセクション- リスナー:画面のアンマウント時にハンドルを削除してください。
- Native sync: 実行
bunx cap syncプラグインのアップグレード後。 - 信頼できる情報源: 信頼
src/definitions.tsGitHub リポジトリ内。
API の概要
「API 概要」セクションconfigureServer
「configureServer」セクション次回の接続で使用するリモート開発サーバーの設定を保存します。
import { LiveReload } from '@capgo/capacitor-live-reload';
const result = await LiveReload.configureServer({ url: 'https://example.com' });console.log(result);connect
「connect」セクションWebSocket接続が確立されていない場合に、接続を開始します。
import { LiveReload } from '@capgo/capacitor-live-reload';
const result = await LiveReload.connect();console.log(result);disconnect
「disconnect」セクション現在のWebSocket接続を閉じ、自動再接続を無効にします。
import { LiveReload } from '@capgo/capacitor-live-reload';
const result = await LiveReload.disconnect();console.log(result);getStatus
“getStatus” セクション現在の接続ステータスを返します。
import { LiveReload } from '@capgo/capacitor-live-reload';
const result = await LiveReload.getStatus();console.log(result);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({ path: 'path/to/file' });型リファレンス
“Type Reference” セクションConfigureServerOptions
“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
“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';Source of Truth
「Source Of Truth」セクションこのページはプラグインの src/definitions.tsから生成されています。上流の公開 API が変更された場合は、再度 sync を実行してください。
Getting Startedの続きを進める
「Getting Started」の次のステップ使用している場合 スタートガイド ダッシュボードの計画や API 操作を行うには、以下と連携してください: @capgo/capacitor-live-reload を使用する @capgo/capacitor-live-reload を使用した Native Build の機能については、 API の概要 API の概要にある実装の詳細については、 はじめに はじめににある実装の詳細については、 API キー API Keys にある実装の詳細については、 デバイス 実装の詳細については Devices を参照してください。