@capgo/capacitor-webview-crash 8.1.9 → 8.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,24 +1,46 @@
1
1
  # @capgo/capacitor-webview-crash
2
2
 
3
- <a href="https://capgo.app/">
3
+ Keep your Capacitor app alive when the WebView crashes: detect recovered crashes, restart dead WebViews natively, and recycle long-running WebViews before they run out of memory.
4
+
5
+ <a href="https://capgo.app/?ref=plugin_webview_crash">
4
6
  <img
5
- src="https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png"
7
+ src="https://capgo.app/readme-banner.svg?repo=Cap-go/capacitor-webview-crash"
6
8
  alt="Capgo - Instant updates for Capacitor"
7
9
  />
8
10
  </a>
9
11
 
10
12
  <div align="center">
13
+ <p>
14
+ <b>Capgo</b>: open-source live updates for Ionic and Capacitor apps. Ship OTA fixes and features instantly, without
15
+ waiting for app store review.
16
+ </p>
11
17
  <h2>
12
- <a href="https://capgo.app/?ref=plugin_webview_crash"> ➡️ Get Instant updates for your App with Capgo</a>
18
+ <a href="https://capgo.app/register/?ref=plugin_webview_crash">➡️ Get started for free</a>
13
19
  </h2>
14
- <h2>
20
+ <p>14-day unlimited free trial. No credit card required</p>
21
+ <p>
15
22
  <a href="https://capgo.app/consulting/?ref=plugin_webview_crash">
16
- Missing a feature? We’ll build the plugin for you 💪
23
+ Missing a feature? We'll build the plugin for you 💪
17
24
  </a>
18
- </h2>
25
+ </p>
19
26
  </div>
20
27
 
21
- Detect recovered Capacitor WebView crashes, restart dead WebViews natively, and optionally recycle long-running WebViews on a fixed interval before memory pressure turns into an OOM.
28
+ <p align="center">
29
+ <img
30
+ src="https://raw.githubusercontent.com/Cap-go/capacitor-webview-crash/main/assets/github-social-preview.png"
31
+ alt="@capgo/capacitor-webview-crash for Capacitor apps"
32
+ width="300"
33
+ />
34
+ </p>
35
+
36
+ ## Key features
37
+
38
+ - **Crash recovery**: `restartOnCrash` restarts the WebView when its renderer process dies.
39
+ - **Recovery info**: `getPendingCrashInfo()` and `clearPendingCrashInfo()`, plus the `webViewRestoredAfterCrash` event.
40
+ - **Scheduled recycling**: `restartIntervalMs` or `restartCron` replaces long-running WebViews.
41
+ - **Manual restart**: `restartWebView()` creates a fresh WebView.
42
+ - **Testing**: `simulateCrashRecovery()` exercises your recovery flow.
43
+ - **Platforms**: iOS and Android. Web only supports the testing helpers.
22
44
 
23
45
  ## What It Does
24
46
 
@@ -9,6 +9,7 @@ import java.time.ZoneId;
9
9
  import java.time.ZonedDateTime;
10
10
  import java.time.temporal.ChronoUnit;
11
11
  import org.json.JSONException;
12
+ import org.json.JSONObject;
12
13
 
13
14
  final class WebViewCrash {
14
15
 
@@ -97,6 +98,10 @@ final class WebViewCrash {
97
98
  }
98
99
  }
99
100
 
101
+ static Object coalescePendingCrashInfo(JSObject pendingCrashInfo, Object jsonNullSentinel) {
102
+ return pendingCrashInfo != null ? pendingCrashInfo : jsonNullSentinel;
103
+ }
104
+
100
105
  static final class RestartOptions {
101
106
 
102
107
  final boolean restartOnCrash;
@@ -91,8 +91,7 @@ public class WebViewCrashPlugin extends Plugin {
91
91
  @PluginMethod
92
92
  public void getPendingCrashInfo(PluginCall call) {
93
93
  JSObject result = new JSObject();
94
- JSObject pendingCrashInfo = implementation.readPendingCrashInfo(getContext());
95
- result.put("value", pendingCrashInfo != null ? pendingCrashInfo : JSONObject.NULL);
94
+ result.put("value", WebViewCrash.coalescePendingCrashInfo(implementation.readPendingCrashInfo(getContext()), JSONObject.NULL));
96
95
  call.resolve(result);
97
96
  }
98
97
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-webview-crash",
3
- "version": "8.1.9",
3
+ "version": "8.1.11",
4
4
  "description": "Capacitor plugin for detecting WebView crash recovery and restarting long-running WebViews natively.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -53,6 +53,7 @@
53
53
  "watch": "tsc --watch",
54
54
  "prepublishOnly": "bun run build",
55
55
  "check:wiring": "node scripts/check-capacitor-plugin-wiring.mjs",
56
+ "check:cap9-deprecated": "node scripts/check-cap9-deprecated.mjs",
56
57
  "example:install": "cd example-app && bun install --frozen-lockfile",
57
58
  "example:build": "bun run build && cd example-app && bun install --frozen-lockfile && bun run build",
58
59
  "changelog:ai": "node scripts/generate-ai-changelog.mjs"