@esmx/router 3.0.0-rc.108 → 3.0.0-rc.110
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/micro-app.d.ts
CHANGED
package/dist/micro-app.mjs
CHANGED
|
@@ -24,8 +24,12 @@ export class MicroApp {
|
|
|
24
24
|
__publicField(this, "app", null);
|
|
25
25
|
__publicField(this, "root", null);
|
|
26
26
|
__publicField(this, "_factory", null);
|
|
27
|
+
__publicField(this, "destroyed", false);
|
|
27
28
|
}
|
|
28
29
|
_update(router, force = false) {
|
|
30
|
+
if (this.destroyed) {
|
|
31
|
+
throw new Error("MicroApp has been destroyed");
|
|
32
|
+
}
|
|
29
33
|
const factory = this._getNextFactory(router);
|
|
30
34
|
if (!force && factory === this._factory) {
|
|
31
35
|
return;
|
|
@@ -81,5 +85,6 @@ export class MicroApp {
|
|
|
81
85
|
(_b = this.root) == null ? void 0 : _b.remove();
|
|
82
86
|
this.root = null;
|
|
83
87
|
this._factory = null;
|
|
88
|
+
this.destroyed = true;
|
|
84
89
|
}
|
|
85
90
|
}
|
|
@@ -44,6 +44,7 @@ export declare class RouteTransition {
|
|
|
44
44
|
beforeEach: RouteConfirmHook[];
|
|
45
45
|
afterEach: RouteNotifyHook[];
|
|
46
46
|
};
|
|
47
|
+
private destroyed;
|
|
47
48
|
constructor(router: Router);
|
|
48
49
|
beforeEach(guard: RouteConfirmHook): () => void;
|
|
49
50
|
afterEach(guard: RouteNotifyHook): () => void;
|
|
@@ -290,11 +290,11 @@ export class RouteTransition {
|
|
|
290
290
|
__publicField(this, "route", null);
|
|
291
291
|
// Task controller for the current transition.
|
|
292
292
|
__publicField(this, "_controller", null);
|
|
293
|
-
// Guard arrays, responsible for storing navigation guards.
|
|
294
293
|
__publicField(this, "guards", {
|
|
295
294
|
beforeEach: [],
|
|
296
295
|
afterEach: []
|
|
297
296
|
});
|
|
297
|
+
__publicField(this, "destroyed", false);
|
|
298
298
|
this.router = router;
|
|
299
299
|
}
|
|
300
300
|
beforeEach(guard) {
|
|
@@ -313,9 +313,15 @@ export class RouteTransition {
|
|
|
313
313
|
var _a;
|
|
314
314
|
(_a = this._controller) == null ? void 0 : _a.abort();
|
|
315
315
|
this._controller = null;
|
|
316
|
+
this.guards.afterEach.length = 0;
|
|
317
|
+
this.guards.beforeEach.length = 0;
|
|
318
|
+
this.destroyed = true;
|
|
316
319
|
}
|
|
317
320
|
async to(toType, toInput) {
|
|
318
321
|
var _a;
|
|
322
|
+
if (this.destroyed) {
|
|
323
|
+
throw new Error("RouteTransition has been destroyed");
|
|
324
|
+
}
|
|
319
325
|
const from = this.route;
|
|
320
326
|
const to = await this._runTask(
|
|
321
327
|
new Route({
|
package/package.json
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"unbuild": "3.6.1",
|
|
40
40
|
"vitest": "3.2.4"
|
|
41
41
|
},
|
|
42
|
-
"version": "3.0.0-rc.
|
|
42
|
+
"version": "3.0.0-rc.110",
|
|
43
43
|
"type": "module",
|
|
44
44
|
"private": false,
|
|
45
45
|
"exports": {
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"template",
|
|
59
59
|
"public"
|
|
60
60
|
],
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "0cea5581bcb0774a0350565bcda33073c3123a3d"
|
|
62
62
|
}
|
package/src/micro-app.ts
CHANGED
|
@@ -34,8 +34,12 @@ export class MicroApp {
|
|
|
34
34
|
public app: RouterMicroAppOptions | null = null;
|
|
35
35
|
public root: HTMLElement | null = null;
|
|
36
36
|
private _factory: RouterMicroAppCallback | null = null;
|
|
37
|
+
private destroyed = false;
|
|
37
38
|
|
|
38
39
|
public _update(router: Router, force = false) {
|
|
40
|
+
if (this.destroyed) {
|
|
41
|
+
throw new Error('MicroApp has been destroyed');
|
|
42
|
+
}
|
|
39
43
|
const factory = this._getNextFactory(router);
|
|
40
44
|
if (!force && factory === this._factory) {
|
|
41
45
|
return;
|
|
@@ -97,5 +101,6 @@ export class MicroApp {
|
|
|
97
101
|
this.root?.remove();
|
|
98
102
|
this.root = null;
|
|
99
103
|
this._factory = null;
|
|
104
|
+
this.destroyed = true;
|
|
100
105
|
}
|
|
101
106
|
}
|
package/src/route-transition.ts
CHANGED
|
@@ -394,12 +394,13 @@ export class RouteTransition {
|
|
|
394
394
|
// Task controller for the current transition.
|
|
395
395
|
private _controller: RouteTaskController | null = null;
|
|
396
396
|
|
|
397
|
-
// Guard arrays, responsible for storing navigation guards.
|
|
398
397
|
public readonly guards = {
|
|
399
398
|
beforeEach: [] as RouteConfirmHook[],
|
|
400
399
|
afterEach: [] as RouteNotifyHook[]
|
|
401
400
|
};
|
|
402
401
|
|
|
402
|
+
private destroyed = false;
|
|
403
|
+
|
|
403
404
|
constructor(router: Router) {
|
|
404
405
|
this.router = router;
|
|
405
406
|
}
|
|
@@ -421,12 +422,19 @@ export class RouteTransition {
|
|
|
421
422
|
public destroy(): void {
|
|
422
423
|
this._controller?.abort();
|
|
423
424
|
this._controller = null;
|
|
425
|
+
this.guards.afterEach.length = 0;
|
|
426
|
+
this.guards.beforeEach.length = 0;
|
|
427
|
+
this.destroyed = true;
|
|
424
428
|
}
|
|
425
429
|
|
|
426
430
|
public async to(
|
|
427
431
|
toType: RouteType,
|
|
428
432
|
toInput: RouteLocationInput
|
|
429
433
|
): Promise<Route> {
|
|
434
|
+
if (this.destroyed) {
|
|
435
|
+
throw new Error('RouteTransition has been destroyed');
|
|
436
|
+
}
|
|
437
|
+
|
|
430
438
|
const from = this.route;
|
|
431
439
|
const to = await this._runTask(
|
|
432
440
|
new Route({
|