메뉴로 가기

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-webview-guardian` plugin in my project.

Copy to clipboard

만들기 옵션을 선택하면 플러그인을 설치하기 위해 다음 명령어를 실행하고 아래의 플랫폼별 설명을 따르세요.
bun add @capgo/capacitor-webview-guardian
bunx cap sync

Copy to clipboard

Import
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';

API Overview

API 개요

"startMonitoring"라는 제목의 섹션

import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.startMonitoring();

stopMonitoring

stopMonitoring

자동 전면 모니터링을 중지합니다.

import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.stopMonitoring();

getState

getState

최신 모니터링 상태를 반환합니다.

import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.getState();

checkNow

checkNow

웹뷰의 즉각적인 건강 검사를 강제합니다.

import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.checkNow();

타입 참조

타입 참조

StartMonitoringOptions

StartMonitoringOptions
export interface StartMonitoringOptions {
/**
* Delay (in ms) before running a health check after the app re-enters the foreground.
* Defaults to 600ms to let the bridge finish resuming.
*/
foregroundDebounceMs?: number;
/**
* Script executed via `evaluateJavascript`/`evaluateJavaScript` to confirm the WebView is alive.
* Defaults to `document.readyState`.
*/
pingScript?: string;
/**
* Automatically reloads the WebView when a terminated render process is detected.
* Disable to receive `webviewCrashed` events and restart manually.
*/
autoRestart?: boolean;
/**
* Strategy used when restarting the WebView. Defaults to `reload`.
*/
restartStrategy?: RestartStrategy;
/**
* Custom HTTPS/HTTP URL to load when `restartStrategy` is `customUrl`.
*/
customRestartUrl?: string;
/**
* Emits verbose logging in the native layer when true.
*/
debug?: boolean;
/**
* Whether an immediate health check should be executed right after enabling monitoring.
* Defaults to `true`.
*/
runInitialCheck?: boolean;
}

GuardianState

GuardianState
export interface GuardianState {
monitoring: boolean;
reason: string;
timestamp: string;
lastHealthyAt?: string;
lastRestartAt?: string;
lastCrashAt?: string;
pendingRestartReason?: string;
error?: string;
}

CheckNowOptions

CheckNowOptions
export interface CheckNowOptions {
/**
* Text tag describing why a manual check is being requested.
*/
reason?: string;
}

CheckResult

CheckResult
export interface CheckResult {
healthy: boolean;
restarted: boolean;
reason: string;
timestamp: string;
error?: string;
pendingRestart?: boolean;
}

GuardianEvent

GuardianEvent
export type GuardianEvent = GuardianState;

RestartStrategy

RestartStrategy
export type RestartStrategy = 'reload' | 'reloadFromOrigin' | 'customUrl';

Source Of Truth

Source Of Truth

이 페이지는 플러그인의 src/definitions.ts. upstream의 public API이 변경되었을 때 다시 동기화를 실행하세요.

Getting Started

Getting Started

native 미디어 및 인터페이스 동작을 계획하고자 할 때 Using @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-webview-guardian Using @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-webview-guardian Using @capgo/capacitor-live-activities Using @capgo/capacitor-live-activities Using @capgo/capacitor-live-activities for the native capability in Using @capgo/capacitor-live-activities, @capgo/capacitor-live-activities implementation 세부 사항은 @capgo/capacitor-live-activities에서 확인할 수 있습니다. Using @capgo/capacitor-video-player native 기능은 Using @capgo/capacitor-video-player에서 확인할 수 있습니다. @capgo/capacitor-video-player implementation 세부 사항은 @capgo/capacitor-video-player에서 확인할 수 있습니다.