@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 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
- typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
1192
- const noop = () => {
1193
- };
1194
-
1192
+ //#region computedAsync/index.ts
1195
1193
  function computedAsync(evaluationCallback, initialState, optionsOrRef) {
1196
- var _a;
1197
- let options;
1198
- if (isRef(optionsOrRef)) {
1199
- options = {
1200
- evaluating: optionsOrRef
1201
- };
1202
- } else {
1203
- options = {};
1204
- }
1205
- const {
1206
- lazy = false,
1207
- flush = "pre",
1208
- evaluating = void 0,
1209
- shallow = true,
1210
- onError = (_a = globalThis.reportError) != null ? _a : noop
1211
- } = options;
1212
- const started = shallowRef(!lazy);
1213
- const current = shallow ? shallowRef(initialState) : ref(initialState);
1214
- let counter = 0;
1215
- watchEffect(async (onInvalidate) => {
1216
- if (!started.value)
1217
- return;
1218
- counter++;
1219
- const counterAtBeginning = counter;
1220
- let hasFinished = false;
1221
- if (evaluating) {
1222
- Promise.resolve().then(() => {
1223
- evaluating.value = true;
1224
- });
1225
- }
1226
- try {
1227
- const result = await evaluationCallback((cancelCallback) => {
1228
- onInvalidate(() => {
1229
- if (evaluating)
1230
- evaluating.value = false;
1231
- if (!hasFinished)
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) {