@capgo/capacitor-webview-crash
Detect recovered WebView crashes and handle lost in-memory state after the WebView restarts.
Overview
Section titled “Overview”This plugin stores a native crash marker when the previous Capacitor WebView process dies, then exposes that marker to the next JavaScript runtime after the app recovers.
Core Capabilities
Section titled “Core Capabilities”getPendingCrashInfo- Returns the stored native crash marker, ornullwhen nothing is pending.clearPendingCrashInfo- Clears the stored crash marker after your app has restored its state.simulateCrashRecovery- Creates a fake crash marker so recovery flows can be tested locally.addListener- FireswebViewRestoredAfterCrashwhen a listener attaches and a crash marker is still pending.
Public API
Section titled “Public API”| Method | Description |
|---|---|
getPendingCrashInfo | Returns the stored native crash marker, or null when nothing is pending. |
clearPendingCrashInfo | Clears the stored crash marker after your app has restored its state. |
simulateCrashRecovery | Creates a fake crash marker so recovery flows can be tested locally. |
addListener | Fires webViewRestoredAfterCrash when a listener attaches and a crash marker is still pending. |
removeAllListeners | Removes all plugin listeners. |
- This plugin detects recovery after a WebView crash. It does not prevent the underlying crash.
- The recovered JavaScript runtime is new, so any in-memory state from the previous WebView is already gone when this API fires.
- On Android, extra fields such as
didCrashandrendererPriorityAtExitmay be available. - On iOS, the plugin records
appStatewhen the terminated WebView process is observed.
Source Of Truth
Section titled “Source Of Truth”This reference is synced from src/definitions.ts in capacitor-webview-crash.