Skip to content

スタートガイド

GitHub

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セットアップを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。

ターミナル画面
bun add @capgo/capacitor-live-reload
bunx cap sync
import { LiveReload } from '@capgo/capacitor-live-reload';

APIの概要

APIの概要

接続先の開発サーバーの設定を保存して、次回の接続に使用します。

import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.configureServer({} as ConfigureServerOptions);

既存のWebSocket接続がなければ、WebSocket接続を確立します。

import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.connect();

現在のWebSocket接続を閉じて、自動再接続を無効にします。

import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.disconnect();

現在の接続状況を取得します。

import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.getStatus();

Capacitor WebViewをフルリロードトリガーします。

import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.reload();

サポートされている場合、ランタイムが単一ファイル/モジュールをリロードします (フルリロードにフォールバック)。

import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.reloadFile({} as FileUpdatePayload);
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;
}
export interface LiveReloadStatus {
connected: boolean;
url?: string;
}
export interface FileUpdatePayload {
path: string;
hash?: string;
}
export type LiveReloadEventCallback = (event: LiveReloadEventPayload) => void;
export type LiveReloadStatusCallback = (status: LiveReloadStatus) => void;
export interface LiveReloadEventPayload {
type: LiveReloadMessageType;
/** Populated when type === 'file-update'. */
file?: FileUpdatePayload;
/** Optional human-readable message for errors or status changes. */
message?: string;
}
export type LiveReloadMessageType = 'full-reload' | 'file-update' | 'error' | 'connected' | 'disconnected';

真実の源

「真実の源」

このページはプラグインの src/definitions.tsAPIがアップストリームで変更された場合に、パブリック API を再同期してください。

「始めてから続けて」

「始めてから続けて」

あなたが 「始めてから続けて」 を使用している場合、ダッシュボードとAPIの作業を計画するには、 Using @capgo/capacitor-live-reload 「@capgo/capacitor-live-reload」 API Overview API の実装詳細 Introduction Introduction の実装詳細 API Keys API Keys の実装詳細 Devices Devices の実装詳細