@extscreen/es-core 2.3.9 → 2.3.11
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 +60 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -2585,6 +2585,8 @@ class ESLaunchManager {
|
|
2585
2585
|
|
2586
2586
|
_routeListener = null;
|
2587
2587
|
|
2588
|
+
_routeListenerList = [];
|
2589
|
+
|
2588
2590
|
init(router) {
|
2589
2591
|
try {
|
2590
2592
|
this._ESRouter = router;
|
@@ -2641,14 +2643,70 @@ class ESLaunchManager {
|
|
2641
2643
|
}
|
2642
2644
|
}
|
2643
2645
|
|
2646
|
+
//-----------------------------------------------------------
|
2647
|
+
|
2648
|
+
addRouteListener(routeListener) {
|
2649
|
+
if (this._routeListenerList && this._routeListenerList.length > 0) {
|
2650
|
+
for (let i = 0; i < this._routeListenerList.length; i++) {
|
2651
|
+
let l = this._routeListenerList[i];
|
2652
|
+
if (l === routeListener) {
|
2653
|
+
return;
|
2654
|
+
}
|
2655
|
+
}
|
2656
|
+
}
|
2657
|
+
this._routeListenerList.push(routeListener);
|
2658
|
+
}
|
2659
|
+
|
2660
|
+
removeRouteListener(routeListener) {
|
2661
|
+
if (this._routeListenerList && this._routeListenerList.length > 0) {
|
2662
|
+
let index = -1;
|
2663
|
+
for (let i = 0; i < this._routeListenerList.length; i++) {
|
2664
|
+
let l = this._routeListenerList[i];
|
2665
|
+
if (l === routeListener) {
|
2666
|
+
index = i;
|
2667
|
+
}
|
2668
|
+
}
|
2669
|
+
if (index > -1) {
|
2670
|
+
this._routeListenerList.splice(index, 1);
|
2671
|
+
}
|
2672
|
+
}
|
2673
|
+
}
|
2674
|
+
|
2675
|
+
_notifyRouteListenerList(url, params) {
|
2676
|
+
try {
|
2677
|
+
if (this._routeListenerList && this._routeListenerList.length > 0) {
|
2678
|
+
for (let i = 0; i < this._routeListenerList.length; i++) {
|
2679
|
+
let listener = this._routeListenerList[i];
|
2680
|
+
if (listener) {
|
2681
|
+
try {
|
2682
|
+
listener(url, params);
|
2683
|
+
} catch (e) {
|
2684
|
+
}
|
2685
|
+
}
|
2686
|
+
}
|
2687
|
+
}
|
2688
|
+
} catch (e) {
|
2689
|
+
}
|
2690
|
+
}
|
2691
|
+
|
2644
2692
|
//-----------------------------------------------------------
|
2645
2693
|
setRouteListener(routeListener) {
|
2646
2694
|
this._routeListener = routeListener;
|
2647
2695
|
}
|
2648
2696
|
|
2649
2697
|
_notifyListeners(url, params) {
|
2650
|
-
|
2651
|
-
|
2698
|
+
//1.单独的监听
|
2699
|
+
try {
|
2700
|
+
if (this._routeListener && this.isFunction(this._routeListener)) {
|
2701
|
+
this._routeListener(url, params);
|
2702
|
+
}
|
2703
|
+
} catch (e) {
|
2704
|
+
|
2705
|
+
}
|
2706
|
+
//2.
|
2707
|
+
try {
|
2708
|
+
this._notifyRouteListenerList(url, params);
|
2709
|
+
} catch (e) {
|
2652
2710
|
}
|
2653
2711
|
}
|
2654
2712
|
|