@authup/client-web-kit 1.0.0-beta.29 → 1.0.0-beta.30
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.mjs +38 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +27 -27
package/dist/index.mjs
CHANGED
|
@@ -642,6 +642,7 @@ function tryOnScopeDispose(fn, failSilently) {
|
|
|
642
642
|
return false;
|
|
643
643
|
}
|
|
644
644
|
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
645
|
+
const noop = () => {};
|
|
645
646
|
|
|
646
647
|
/**
|
|
647
648
|
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
|
|
@@ -1188,68 +1189,44 @@ class MemoryStore {
|
|
|
1188
1189
|
}
|
|
1189
1190
|
}
|
|
1190
1191
|
|
|
1191
|
-
|
|
1192
|
-
const noop = () => {
|
|
1193
|
-
};
|
|
1194
|
-
|
|
1192
|
+
//#region computedAsync/index.ts
|
|
1195
1193
|
function computedAsync(evaluationCallback, initialState, optionsOrRef) {
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
cancelCallback();
|
|
1233
|
-
});
|
|
1234
|
-
});
|
|
1235
|
-
if (counterAtBeginning === counter)
|
|
1236
|
-
current.value = result;
|
|
1237
|
-
} catch (e) {
|
|
1238
|
-
onError(e);
|
|
1239
|
-
} finally {
|
|
1240
|
-
if (evaluating && counterAtBeginning === counter)
|
|
1241
|
-
evaluating.value = false;
|
|
1242
|
-
hasFinished = true;
|
|
1243
|
-
}
|
|
1244
|
-
}, { flush });
|
|
1245
|
-
if (lazy) {
|
|
1246
|
-
return computed(() => {
|
|
1247
|
-
started.value = true;
|
|
1248
|
-
return current.value;
|
|
1249
|
-
});
|
|
1250
|
-
} else {
|
|
1251
|
-
return current;
|
|
1252
|
-
}
|
|
1194
|
+
var _globalThis$reportErr;
|
|
1195
|
+
let options;
|
|
1196
|
+
if (isRef(optionsOrRef)) options = { evaluating: optionsOrRef };
|
|
1197
|
+
else options = optionsOrRef || {};
|
|
1198
|
+
const { lazy = false, flush = "sync", evaluating = void 0, shallow = true, onError = (_globalThis$reportErr = globalThis.reportError) !== null && _globalThis$reportErr !== void 0 ? _globalThis$reportErr : noop } = options;
|
|
1199
|
+
const started = shallowRef(!lazy);
|
|
1200
|
+
const current = shallow ? shallowRef(initialState) : ref(initialState);
|
|
1201
|
+
let counter = 0;
|
|
1202
|
+
watchEffect(async (onInvalidate) => {
|
|
1203
|
+
if (!started.value) return;
|
|
1204
|
+
counter++;
|
|
1205
|
+
const counterAtBeginning = counter;
|
|
1206
|
+
let hasFinished = false;
|
|
1207
|
+
if (evaluating) Promise.resolve().then(() => {
|
|
1208
|
+
evaluating.value = true;
|
|
1209
|
+
});
|
|
1210
|
+
try {
|
|
1211
|
+
const result = await evaluationCallback((cancelCallback) => {
|
|
1212
|
+
onInvalidate(() => {
|
|
1213
|
+
if (evaluating) evaluating.value = false;
|
|
1214
|
+
if (!hasFinished) cancelCallback();
|
|
1215
|
+
});
|
|
1216
|
+
});
|
|
1217
|
+
if (counterAtBeginning === counter) current.value = result;
|
|
1218
|
+
} catch (e) {
|
|
1219
|
+
onError(e);
|
|
1220
|
+
} finally {
|
|
1221
|
+
if (evaluating && counterAtBeginning === counter) evaluating.value = false;
|
|
1222
|
+
hasFinished = true;
|
|
1223
|
+
}
|
|
1224
|
+
}, { flush });
|
|
1225
|
+
if (lazy) return computed(() => {
|
|
1226
|
+
started.value = true;
|
|
1227
|
+
return current.value;
|
|
1228
|
+
});
|
|
1229
|
+
else return current;
|
|
1253
1230
|
}
|
|
1254
1231
|
|
|
1255
1232
|
function inject(key, instance) {
|