@simonbackx/vue-app-navigation 2.18.0 → 2.18.1

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.
Files changed (2) hide show
  1. package/dist/index.js +16 -4
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -244,6 +244,9 @@ class HistoryManagerStatic {
244
244
  this.isQueueRunning = true;
245
245
  const action = this.historyQueue.shift();
246
246
  if (action) {
247
+ if (this.debug) {
248
+ console.log("Running history queue action");
249
+ }
247
250
  const p = action();
248
251
  if (p) {
249
252
  p.finally(() => this.runQueue()).catch(console.error);
@@ -251,6 +254,9 @@ class HistoryManagerStatic {
251
254
  this.runQueue();
252
255
  }
253
256
  } else {
257
+ if (this.debug) {
258
+ console.log("History queue done");
259
+ }
254
260
  this.isQueueRunning = false;
255
261
  this.callListeners();
256
262
  }
@@ -262,11 +268,17 @@ class HistoryManagerStatic {
262
268
  history.go(delta);
263
269
  let timer = void 0;
264
270
  let called = false;
271
+ const startTime = /* @__PURE__ */ new Date();
265
272
  const listener = () => {
266
273
  if (called) return;
267
274
  called = true;
268
275
  clearTimeout(timer);
269
276
  window.removeEventListener("popstate", listener);
277
+ const end = /* @__PURE__ */ new Date();
278
+ if (this.debug) {
279
+ const ms = end.getTime() - startTime.getTime();
280
+ console.log("Waiting for popstate event took " + ms + "ms");
281
+ }
270
282
  setTimeout(() => {
271
283
  this.manualStateAction = false;
272
284
  resolve();
@@ -276,7 +288,7 @@ class HistoryManagerStatic {
276
288
  timer = setTimeout(() => {
277
289
  console.warn("Timeout while waiting for history.go");
278
290
  listener();
279
- }, 200);
291
+ }, 400);
280
292
  });
281
293
  });
282
294
  }
@@ -523,9 +535,9 @@ class HistoryManagerStatic {
523
535
  activate() {
524
536
  history.scrollRestoration = "manual";
525
537
  async function onPopState(event) {
526
- var _a;
538
+ var _a, _b;
527
539
  if (this.debug) {
528
- console.log("HistoryManager popstate");
540
+ console.log("HistoryManager popstate", (_a = event.state) == null ? void 0 : _a.counter);
529
541
  }
530
542
  if (this.isAdjustingState) {
531
543
  console.warn("Duplicate popstate");
@@ -534,8 +546,8 @@ class HistoryManagerStatic {
534
546
  if (this.manualStateAction) {
535
547
  return;
536
548
  }
549
+ const newCounter = (_b = event.state) == null ? void 0 : _b.counter;
537
550
  this.isAdjustingState = true;
538
- const newCounter = (_a = event.state) == null ? void 0 : _a.counter;
539
551
  if (newCounter !== void 0) {
540
552
  if (newCounter > this.counter) {
541
553
  if (this.debug) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@simonbackx/vue-app-navigation",
3
3
  "main": "./dist/index.js",
4
4
  "types": "./dist/index.d.ts",
5
- "version": "2.18.0",
5
+ "version": "2.18.1",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": "./dist/index.js",
@@ -31,15 +31,15 @@
31
31
  "eslint-plugin-stamhoofd": "^2.74.0",
32
32
  "sass": "^1.32.4",
33
33
  "tslib": "^2.8.1",
34
- "typescript": "^5.6.2",
34
+ "typescript": "^6.0.3",
35
35
  "vite": "^5.2.10",
36
36
  "vite-plugin-dts": "^3.9.0",
37
37
  "vue": "^3.5.12",
38
38
  "vue-tsc": "^3.2.6"
39
39
  },
40
40
  "peerDependencies": {
41
- "vue": "^3.5.12",
42
- "tslib": "^2.8.1"
41
+ "tslib": "^2.8.1",
42
+ "vue": "^3.5.12"
43
43
  },
44
44
  "dependencies": {
45
45
  "@vue/shared": "^3.5.12"