웹뷰 가디언 저장소
설치 단계와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 지시를 복사하세요.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-webview-guardian`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/webview-guardian/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
설치하기
설치 제목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.만약 Manual Setup을 선호한다면, 다음 명령어를 실행하여 플러그인을 설치하고 아래의 플랫폼별 지침을 따르면 된다.
bun add @capgo/capacitor-webview-guardianbunx cap syncImport
Import 섹션import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';API 개요
API 개요 섹션startMonitoring
startMonitoring 섹션앱 전면 이벤트를 감시하고 WebView의 상태를 자동으로 확인한다.
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.startMonitoring();stopMonitoring
Section titled “stopMonitoring”자동 전면 모니터링을 중지합니다.
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.stopMonitoring();getState
Section titled “getState”최신 모니터링 상태를 반환합니다.
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.getState();checkNow
Section titled “checkNow”즉시 WebView 건강 검사를 강제합니다.
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.checkNow();Type Reference
Section titled “Type Reference”StartMonitoringOptions
Section titled “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.ts. upstream의 API가 변경되었을 때 다시 싱크를 실행하세요.
Getting Started에서 계속
Getting Started에서 계속native 미디어 및 인터페이스 동작을 계획하고 있는 경우 Getting Started native 기능인 @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-webview-guardian native 기능인 @capgo/capacitor-webview-guardian native 기능인 @capgo/capacitor-live-activities native 기능인 @capgo/capacitor-live-activities native 기능인 @capgo/capacitor-live-activities @capgo/capacitor-live-활동 for the implementation detail in @capgo/capacitor-live-activities, Capgo @capgo/capacitor-live-활동 사용 for the native capability in Using @capgo/capacitor-video-player, and Capgo @capgo/capacitor-비디오 플레이어 Capgo @capgo/capacitor-비디오 플레이어