Passer au contenu

@capgo/capacitor-webview-crash

Detect recovered WebView crashes and handle lost in-memory state after the WebView restarts.

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.

  • 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.
MethodDescription
getPendingCrashInfoReturns the stored native crash marker, or null when nothing is pending.
clearPendingCrashInfoClears the stored crash marker after your app has restored its state.
simulateCrashRecoveryCreates a fake crash marker so recovery flows can be tested locally.
addListenerFires webViewRestoredAfterCrash when a listener attaches and a crash marker is still pending.
removeAllListenersRemoves 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 didCrash and rendererPriorityAtExit may be available.
  • On iOS, the plugin records appState when the terminated WebView process is observed.

This reference is synced from src/definitions.ts in capacitor-webview-crash.