@micro-zoe/micro-app 1.0.0-rc.22 → 1.0.0-rc.23
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/lib/index.d.ts +1 -0
- package/lib/index.esm.js +24 -4
- package/lib/index.esm.js.map +1 -1
- package/lib/index.min.js +1 -1
- package/lib/index.min.js.map +1 -1
- package/lib/index.umd.js +1 -1
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -422,6 +422,7 @@ declare module '@micro-zoe/micro-app/interact' {
|
|
|
422
422
|
* @param appName app.name
|
|
423
423
|
*/
|
|
424
424
|
clearDataListener(appName: string): void;
|
|
425
|
+
changeEventAppName(newAppName: string, oldAppName: string): void;
|
|
425
426
|
}
|
|
426
427
|
export class EventCenterForMicroApp extends EventCenterForGlobal {
|
|
427
428
|
appName: string;
|
package/lib/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const version = '1.0.0-rc.
|
|
1
|
+
const version = '1.0.0-rc.23';
|
|
2
2
|
// do not use isUndefined
|
|
3
3
|
const isBrowser = typeof window !== 'undefined';
|
|
4
4
|
// do not use isUndefined
|
|
@@ -2713,6 +2713,14 @@ class EventCenterForBaseApp extends EventCenterForGlobal {
|
|
|
2713
2713
|
clearDataListener(appName) {
|
|
2714
2714
|
eventCenter.off(createEventName(formatAppName(appName), false));
|
|
2715
2715
|
}
|
|
2716
|
+
changeEventAppName(newAppName, oldAppName) {
|
|
2717
|
+
const newEventName = createEventName(formatAppName(newAppName), true);
|
|
2718
|
+
const oldEventName = createEventName(formatAppName(oldAppName), true);
|
|
2719
|
+
if (eventCenter.eventList.has(oldEventName)) {
|
|
2720
|
+
eventCenter.eventList.set(newEventName, eventCenter.eventList.get(oldEventName));
|
|
2721
|
+
eventCenter.eventList.delete(oldEventName);
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2716
2724
|
}
|
|
2717
2725
|
// Event center for sub app
|
|
2718
2726
|
class EventCenterForMicroApp extends EventCenterForGlobal {
|
|
@@ -6580,6 +6588,8 @@ class IframeSandbox {
|
|
|
6580
6588
|
this.deleteIframeElement = this.createIframeElement(appName, browserHost + rawLocation.pathname, options);
|
|
6581
6589
|
this.microAppWindow = this.iframe.contentWindow;
|
|
6582
6590
|
this.patchIframe(this.microAppWindow, (resolve) => {
|
|
6591
|
+
// refresh
|
|
6592
|
+
this.microAppWindow = this.iframe.contentWindow;
|
|
6583
6593
|
// create new html to iframe
|
|
6584
6594
|
this.createIframeTemplate(this.microAppWindow);
|
|
6585
6595
|
// get escapeProperties from plugins
|
|
@@ -7081,10 +7091,10 @@ class CreateApp {
|
|
|
7081
7091
|
return this.setAppState(appStates.LOADING);
|
|
7082
7092
|
}
|
|
7083
7093
|
this.createSandbox();
|
|
7084
|
-
// place outside of nextAction, as nextAction may execute async
|
|
7085
|
-
this.setAppState(appStates.BEFORE_MOUNT);
|
|
7086
7094
|
const nextAction = () => {
|
|
7087
7095
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
7096
|
+
// place inside of nextAction, make sure iframe ready
|
|
7097
|
+
this.setAppState(appStates.BEFORE_MOUNT);
|
|
7088
7098
|
/**
|
|
7089
7099
|
* Special scenes:
|
|
7090
7100
|
* 1. mount before prerender exec mount (loading source)
|
|
@@ -8361,7 +8371,7 @@ function defineElement(tagName) {
|
|
|
8361
8371
|
this.cacheData = null;
|
|
8362
8372
|
this.connectedCount = 0;
|
|
8363
8373
|
this.connectStateMap = new Map();
|
|
8364
|
-
this.
|
|
8374
|
+
this._appName = ''; // app name
|
|
8365
8375
|
this.appUrl = ''; // app url
|
|
8366
8376
|
this.ssrUrl = ''; // html path in ssr mode
|
|
8367
8377
|
this.version = version;
|
|
@@ -8725,6 +8735,7 @@ function defineElement(tagName) {
|
|
|
8725
8735
|
unmountcb,
|
|
8726
8736
|
});
|
|
8727
8737
|
}
|
|
8738
|
+
delete this.__MICRO_APP_NAME__;
|
|
8728
8739
|
}
|
|
8729
8740
|
// hidden app when disconnectedCallback called with keep-alive
|
|
8730
8741
|
handleHiddenKeepAliveApp(callback) {
|
|
@@ -8902,6 +8913,15 @@ function defineElement(tagName) {
|
|
|
8902
8913
|
}
|
|
8903
8914
|
return null;
|
|
8904
8915
|
}
|
|
8916
|
+
set appName(value) {
|
|
8917
|
+
if (value !== this._appName) {
|
|
8918
|
+
microApp.changeEventAppName(value, this._appName);
|
|
8919
|
+
this._appName = value;
|
|
8920
|
+
}
|
|
8921
|
+
}
|
|
8922
|
+
get appName() {
|
|
8923
|
+
return this._appName;
|
|
8924
|
+
}
|
|
8905
8925
|
/**
|
|
8906
8926
|
* get publicPath from a valid address,it can used in micro-app-devtools
|
|
8907
8927
|
*/
|