@xfe-repo/web-micro 1.1.3 → 1.1.4

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/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # `@xfe-repo/web-register`
1
+ # `@xfe-repo/web-micro`
2
2
 
3
- web register库
3
+ web micro
package/dist/index.d.mts CHANGED
@@ -38,6 +38,7 @@ type MicroAppGlobalDataType = {
38
38
  };
39
39
  type MicroAppEventCenterConfig = {
40
40
  name: string;
41
+ isMain?: boolean;
41
42
  onGlobalStateChange?: (globalState: any) => void;
42
43
  };
43
44
  declare class MicroAppEventCenter {
package/dist/index.d.ts CHANGED
@@ -38,6 +38,7 @@ type MicroAppGlobalDataType = {
38
38
  };
39
39
  type MicroAppEventCenterConfig = {
40
40
  name: string;
41
+ isMain?: boolean;
41
42
  onGlobalStateChange?: (globalState: any) => void;
42
43
  };
43
44
  declare class MicroAppEventCenter {
package/dist/index.js CHANGED
@@ -346,7 +346,6 @@ var MicroAppRoute = (0, import_react.memo)(function(props) {
346
346
  }));
347
347
  });
348
348
  // src/index.ts
349
- window.microGlobalEventCenter = new import_micro_app2.EventCenterForMicroApp("global");
350
349
  var MicroAppEventEnum = /* @__PURE__ */ function(MicroAppEventEnum2) {
351
350
  MicroAppEventEnum2["SET_GLOBAL_STATE"] = "setGlobalState";
352
351
  MicroAppEventEnum2["DISPATCH_ACTION"] = "dispatchAction";
@@ -359,6 +358,7 @@ var MicroAppEventCenter = /*#__PURE__*/ function() {
359
358
  this.dispatchListeners = {};
360
359
  this._globalState = {};
361
360
  this.config = config;
361
+ if (config.isMain) window.microGlobalEventCenter = new import_micro_app2.EventCenterForMicroApp("global");
362
362
  window.microGlobalEventCenter.addGlobalDataListener(function(globalData) {
363
363
  return _this.listener(globalData);
364
364
  });
package/dist/index.mjs CHANGED
@@ -268,7 +268,6 @@ var MicroAppRoute = memo(function(props) {
268
268
  }));
269
269
  });
270
270
  // src/index.ts
271
- window.microGlobalEventCenter = new EventCenterForMicroApp("global");
272
271
  var MicroAppEventEnum = /* @__PURE__ */ function(MicroAppEventEnum2) {
273
272
  MicroAppEventEnum2["SET_GLOBAL_STATE"] = "setGlobalState";
274
273
  MicroAppEventEnum2["DISPATCH_ACTION"] = "dispatchAction";
@@ -282,6 +281,7 @@ var MicroAppEventCenter = /*#__PURE__*/ function() {
282
281
  this.dispatchListeners = {};
283
282
  this._globalState = {};
284
283
  this.config = config;
284
+ if (config.isMain) window.microGlobalEventCenter = new EventCenterForMicroApp("global");
285
285
  window.microGlobalEventCenter.addGlobalDataListener(function(globalData) {
286
286
  return _this.listener(globalData);
287
287
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xfe-repo/web-micro",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "sideEffects": false,
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,8 +27,8 @@
27
27
  "devDependencies": {
28
28
  "@types/node": "^20.16.5",
29
29
  "@types/react": "^18",
30
- "@xfe-repo/eslint-config": "0.0.4",
31
- "@xfe-repo/typescript-config": "0.0.6"
30
+ "@xfe-repo/typescript-config": "0.0.6",
31
+ "@xfe-repo/eslint-config": "0.0.4"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "tsup",