컨텐츠로 건너뛰기

Getting Started

GitHub

설치

설치

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-reload
bunx cap sync
import { LiveReload } from '@capgo/capacitor-live-reload';

__CAPGO_KEEP_0__ 이후 연결에 사용되는远程 개발 서버 설정을 저장합니다.

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

__CAPGO_KEEP_0__ 이미 활성화된 WebSocket 연결이 없다면 WebSocket 연결을establish합니다.

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

__CAPGO_KEEP_0__ 현재 WebSocket 연결을 종료하고 자동 재 연결을 비활성화합니다.

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

__CAPGO_KEEP_0__ 현재 연결 상태를 반환합니다.

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

reload

reload

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

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

reloadFile

reloadFile

__CAPGO_KEEP_0__ 런타임이 지원하는 경우 단일 파일/모듈을 재로드합니다. (전체 재로드로 돌아갑니다).

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

Type Reference

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;
}
export interface FileUpdatePayload {
path: string;
hash?: string;
}
export type LiveReloadEventCallback = (event: LiveReloadEventPayload) => void;

LiveReloadStatusCallback

라이브 리로드 상태 콜백
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의 public API이 변경되었을 때 다시 싱크를 실행하세요.

Getting Started에서 계속

Getting Started에서 계속하는 섹션

Capacitor를 사용하는 경우 Getting Started 대시보드 및 API 연산을 계획하려면 Using @capgo/capacitor-live-reload native capability을 사용하는 @capgo/capacitor-live-reload API Overview API Overview 소개 Introduction에서 구현 세부 정보를 위한 API 키 Introduction에서 API 키의 구현 세부 정보를 위한 기기 기기에서 구현 세부 정보를 위한