chayns-api 2.4.22 → 2.4.24
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.
|
@@ -7,6 +7,9 @@ exports.loadModule = exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const loadModule = (scope, module, url, preventSingleton = false) => {
|
|
10
|
+
if (!globalThis.moduleFederationRuntime || !globalThis.moduleFederationScopes) {
|
|
11
|
+
throw new Error('[chayns-api] moduleFederationSharing has not been initialized. Make sure to call initModuleFederationSharing.');
|
|
12
|
+
}
|
|
10
13
|
const {
|
|
11
14
|
loadRemote,
|
|
12
15
|
registerRemotes
|
|
@@ -51,6 +54,9 @@ const loadComponent = (scope, module, url, skipCompatMode = false, preventSingle
|
|
|
51
54
|
if (skipCompatMode) {
|
|
52
55
|
console.warn('[chayns-api] skipCompatMode-option is deprecated and is set automatically now');
|
|
53
56
|
}
|
|
57
|
+
if (!globalThis.moduleFederationRuntime || !globalThis.moduleFederationScopes) {
|
|
58
|
+
throw new Error('[chayns-api] moduleFederationSharing has not been initialized. Make sure to call initModuleFederationSharing.');
|
|
59
|
+
}
|
|
54
60
|
const {
|
|
55
61
|
loadShareSync,
|
|
56
62
|
getInstance
|
|
@@ -33,7 +33,14 @@ class FrameWrapper {
|
|
|
33
33
|
if (!this.initialized) await this.ready;
|
|
34
34
|
return this.exposedFunctions.addScrollListener(value, callback && comlink.proxy(result => callback(result)));
|
|
35
35
|
},
|
|
36
|
-
addVisibilityChangeListener: async callback =>
|
|
36
|
+
addVisibilityChangeListener: async callback => {
|
|
37
|
+
if (!this.initialized) await this.ready;
|
|
38
|
+
try {
|
|
39
|
+
return await this.exposedFunctions.addVisibilityChangeListener(comlink.proxy(result => callback(result)));
|
|
40
|
+
} catch (ex) {
|
|
41
|
+
return (0, _visibilityChangeListener.addVisibilityChangeListener)(callback);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
37
44
|
addToolbarChangeListener: async callback => {
|
|
38
45
|
if (!this.initialized) await this.ready;
|
|
39
46
|
return this.exposedFunctions.addToolbarChangeListener(callback && comlink.proxy(result => callback(result)));
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export const loadModule = function (scope, module, url) {
|
|
3
3
|
let preventSingleton = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
4
|
+
if (!globalThis.moduleFederationRuntime || !globalThis.moduleFederationScopes) {
|
|
5
|
+
throw new Error('[chayns-api] moduleFederationSharing has not been initialized. Make sure to call initModuleFederationSharing.');
|
|
6
|
+
}
|
|
4
7
|
const {
|
|
5
8
|
loadRemote,
|
|
6
9
|
registerRemotes
|
|
@@ -46,6 +49,9 @@ const loadComponent = function (scope, module, url) {
|
|
|
46
49
|
if (skipCompatMode) {
|
|
47
50
|
console.warn('[chayns-api] skipCompatMode-option is deprecated and is set automatically now');
|
|
48
51
|
}
|
|
52
|
+
if (!globalThis.moduleFederationRuntime || !globalThis.moduleFederationScopes) {
|
|
53
|
+
throw new Error('[chayns-api] moduleFederationSharing has not been initialized. Make sure to call initModuleFederationSharing.');
|
|
54
|
+
}
|
|
49
55
|
const {
|
|
50
56
|
loadShareSync,
|
|
51
57
|
getInstance
|
|
@@ -29,7 +29,14 @@ export class FrameWrapper {
|
|
|
29
29
|
if (!this.initialized) await this.ready;
|
|
30
30
|
return this.exposedFunctions.addScrollListener(value, callback && comlink.proxy(result => callback(result)));
|
|
31
31
|
},
|
|
32
|
-
addVisibilityChangeListener: async callback =>
|
|
32
|
+
addVisibilityChangeListener: async callback => {
|
|
33
|
+
if (!this.initialized) await this.ready;
|
|
34
|
+
try {
|
|
35
|
+
return await this.exposedFunctions.addVisibilityChangeListener(comlink.proxy(result => callback(result)));
|
|
36
|
+
} catch (ex) {
|
|
37
|
+
return addVisibilityChangeListener(callback);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
33
40
|
addToolbarChangeListener: async callback => {
|
|
34
41
|
if (!this.initialized) await this.ready;
|
|
35
42
|
return this.exposedFunctions.addToolbarChangeListener(callback && comlink.proxy(result => callback(result)));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const loadModule: (scope:
|
|
2
|
-
declare const loadComponent: (scope:
|
|
1
|
+
export declare const loadModule: (scope: string, module: string, url: string, preventSingleton?: boolean) => any;
|
|
2
|
+
declare const loadComponent: (scope: string, module: string, url: string, skipCompatMode?: boolean, preventSingleton?: boolean) => any;
|
|
3
3
|
export default loadComponent;
|