@mushi-mushi/core 1.22.1 → 1.22.4

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/dist/index.js CHANGED
@@ -45,7 +45,10 @@ function getSubtle() {
45
45
  try {
46
46
  const g = globalThis;
47
47
  const crypto2 = g["crypto"];
48
- if (crypto2?.subtle) return crypto2.subtle;
48
+ const subtle = crypto2?.subtle;
49
+ if (subtle && typeof subtle.digest === "function" && typeof subtle.importKey === "function" && typeof subtle.sign === "function") {
50
+ return subtle;
51
+ }
49
52
  } catch {
50
53
  }
51
54
  return null;
@@ -1235,6 +1238,7 @@ function createOfflineQueue(config = {}) {
1235
1238
  }
1236
1239
  function startAutoSync(client) {
1237
1240
  if (!enabled || !syncOnReconnect || typeof window === "undefined") return;
1241
+ if (syncCleanup) stopAutoSync();
1238
1242
  const tryFlush = () => {
1239
1243
  if (navigator.onLine) {
1240
1244
  flush(client).catch((err) => {