시작하기
설치, 동기화 및 이 플러그인의 전체 마크다운 가이드를 포함한 설정 명령어를 복사하세요.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-webview-crash`
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-crash/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.
설치
설치란bun add @capgo/capacitor-webview-crashbunx cap sync수입
수입란import { WebViewCrash } from '@capgo/capacitor-webview-crash';권장 복구 흐름
권장 복구 흐름란앱 시작 시 가능한 한 리스너를 첨부하여 복구된 런타임이 사용자가 계속 탐색하기 전에 반응할 수 있도록 하세요.
import { WebViewCrash } from '@capgo/capacitor-webview-crash';
await WebViewCrash.addListener('webViewRestoredAfterCrash', async (info) => { console.log('Recovered after a WebView crash', info);
// Rehydrate critical state, reopen the correct screen, or prompt the user to retry. await WebViewCrash.clearPendingCrashInfo();});
const pending = await WebViewCrash.getPendingCrashInfo();// Note: the listener callback may have already cleared the pending marker.if (pending.value) { console.log('Pending crash marker', pending.value);}API 개요
API 개요getPendingCrashInfo
__CAPGO_KEEP_0__ pending 정보 가져오기저장된 네이티브 충돌 마커를 반환하거나, null nothing이 pending일 때.
const pending = await WebViewCrash.getPendingCrashInfo();if (pending.value) { console.log(pending.value.platform, pending.value.reason);}clearPendingCrashInfo
__CAPGO_KEEP_0__ pending 충돌 마커 지우기충돌 마커를 지우고 recovery 처리가 끝난 후.
await WebViewCrash.clearPendingCrashInfo();simulateCrashRecovery
__CAPGO_KEEP_0__ 충돌 recovery 시뮬레이션QA 및 로컬 디버깅을 위해 실제 WebView를 충돌시키지 않고 recovery 경로를 연습할 수 있는 가짜 충돌 마커를 생성합니다.
const simulated = await WebViewCrash.simulateCrashRecovery();console.log(simulated.value);플랫폼 참고사항
플랫폼 참고 사항- Android는
onRenderProcessGone, 포함하여didCrash및rendererPriorityAtExit플랫폼이 제공할 때 - iOS는
webViewWebContentProcessDidTerminate및 현재 애플리케이션 상태를 제공할 때 - 웹에서는 실제 렌더러 충돌을 감지하지 않습니다. 웹 구현은 로컬 스토리지만 사용하여 동작을 시뮬레이션합니다.
타입 참조
플랫폼 참고 사항PendingCrashInfoResult
Section titled “PendingCrashInfoResult”export interface PendingCrashInfoResult { /** * Stored crash metadata, or `null` when no marker is pending. */ value: WebViewCrashInfo | null;}WebViewCrashInfo
웹뷰 충돌 정보 섹션export interface WebViewCrashInfo { /** * Platform that detected and stored the crash marker. */ platform: WebViewCrashPlatform;
/** * Unix timestamp in milliseconds for when the crash marker was written. */ timestamp: number;
/** * ISO-8601 version of `timestamp`. */ timestampISO: string;
/** * Platform-specific reason for the crash marker. */ reason: WebViewCrashReason;
/** * Last known WebView URL when the crash marker was written. */ url?: string;
/** * Android-only hint from `RenderProcessGoneDetail.didCrash()`. */ didCrash?: boolean;
/** * Android-only renderer priority reported at exit. */ rendererPriorityAtExit?: number;
/** * iOS-only application state captured when the WebView process died. */ appState?: WebViewCrashAppState;}WebViewCrashPlatform
웹뷰 충돌 플랫폼 섹션export type WebViewCrashPlatform = 'android' | 'ios' | 'web';WebViewCrashReason
웹뷰 충돌 이유 섹션export type WebViewCrashReason = 'renderProcessGone' | 'webContentProcessDidTerminate' | 'simulated';WebViewCrashAppState
웹뷰 충돌 앱 상태 섹션export type WebViewCrashAppState = 'active' | 'inactive' | 'background' | 'unknown';실질적 출처
실질적 출처 섹션이 페이지는 플러그인의 src/definitions.tsAPI이 업스트림에서 변경될 때 다시 동기화할 수 있습니다.