Skip to content

Getting Started

GitHub
터미널 창
bun add @capgo/capacitor-webview-guardian
bunx cap sync
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';

__CAPGO_KEEP_0__ 시작하면 전면 이벤트를 관찰하고 WebView의 건강을 자동으로 확인합니다.

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

__CAPGO_KEEP_0__ 종료하면 자동 전면 모니터링을 중지합니다.

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

__CAPGO_KEEP_0__ 복사

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

checkNow

checkNow

즉시 WebView 건강 검사를 강제합니다.

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';

실제 데이터의 원천

실제 데이터의 원천

이 페이지는 플러그인의 src/definitions.tsAPI이 업스트림에서 변경될 때 다시 싱크를 실행하세요.

Getting Started에서 계속

Getting Started에서 계속

이미 사용 중입니다 Getting Started native 미디어 및 인터페이스 동작을 계획하고 연결하기 위해 Using @capgo/capacitor-webview-guardian Capacitor의 native 기능을 사용하기 위해 Using @capgo/capacitor-webview-guardian Using @capgo/capacitor-live-activities Capacitor의 native 기능을 사용하기 위해 Using @capgo/capacitor-live-activities @capgo/capacitor-live-activities Capacitor의 구현 세부 정보에 대해 @capgo/capacitor-live-activities Using @capgo/capacitor-video-player Capacitor의 native 기능을 사용하기 위해 Using @capgo/capacitor-video-player, 그리고 @capgo/capacitor-video-player Capacitor의 구현 세부 정보에 대해 @capgo/capacitor-video-player.