컨텐츠로 바로가기

Getting Started

GitHub

Capgo의 AI-Assisted Setup을 사용하여 플러그인을 설치할 수 있습니다. 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';

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

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 WebView를 완전히 다시 로드합니다.

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

__CAPGO_KEEP_0__ (단일 파일/모듈이 런타임이 지원하는 경우에만 재로드, 그렇지 않으면 전체 재로드)

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;
}
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 API이 업스트림에서 변경될 때마다 pubic을 다시 동기화하세요.

Getting Started에서 계속

Getting Started에서 계속 섹션 제목

Capgo를 사용 중이라면 Getting Started 대시보드와 API 연산을 계획하고 연결하려면 native 기능을 사용하기 위해 @capgo/capacitor-live-reload Using @capgo/capacitor-live-reload API 개요 API Overview implementation 세부 정보를 위해 __CAPGO_KEEP_0__ Overview implementation 세부 정보를 위해 Introduction API 키 API Keys implementation 세부 정보를 위해 __CAPGO_KEEP_0__ Keys, 그리고 __CAPGO_KEEP_0__ 구현 세부 사항입니다.