컨텐츠로 바로가기

Getting Started

GitHub

__CAPGO_KEEP_3__

__CAPGO_KEEP_4__

Capgo을 사용하여 플러그인을 설치하는 데 도움을 주는 AI-assisted 설정을 사용할 수 있습니다. 다음 명령어를 사용하여 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.

만약에 수동 설정을 선호한다면, 플러그인을 설치하기 위해 다음 명령어를 실행하고 아래에 플랫폼에 따라 설명된 지침을 따르세요.

터미널 창
bun add @capgo/capacitor-live-reload
bunx cap sync
import { LiveReload } from '@capgo/capacitor-live-reload';

API 개요

API 개요

__CAPGO_KEEP_0__ 설정을 저장하여 이후 연결에 사용합니다.

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

WebSocket 연결을establish합니다. 연결이 이미 활성화되어 있다면.

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 웹뷰의 전체 재로드를 트리거합니다.

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

복사

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

__CAPGO_KEEP_0__ 웹뷰의 전체 재로드를 트리거합니다.

__CAPGO_KEEP_0__ 웹뷰의 전체 재로드를 트리거합니다.

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;
}
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.ts. upstream의 API가 변경되었을 때 다시 싱크를 실행하세요.

Getting Started에서 계속

Getting Started에서 계속

이러한 기능을 사용 중이라면 Getting Started를 사용하여 대시보드와 API를 계획하고 운영하기 위해 Using @capgo/capacitor-live-reload Using @capgo/capacitor-live-reload API 개요 API 개요 __CAPGO_KEEP_0__ Introduction API Keys API Keys Capgo 구현 세부 사항에 대한 설명 Devices