phecda-web 1.0.1-beta.10 → 1.0.1-beta.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.d.ts +2 -2
- package/dist/index.js +9 -9
- package/dist/index.mjs +9 -9
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -20,8 +20,8 @@ declare function waitUntilInit(...instances: InstanceType<Construct>[]): Promise
|
|
|
20
20
|
declare function resetActiveInstance(instance?: ActiveInstance): void;
|
|
21
21
|
declare function getActiveInstance(): ActiveInstance;
|
|
22
22
|
declare function serializeState(): any;
|
|
23
|
-
declare function isModuleLoad(
|
|
24
|
-
declare function unmountModule(
|
|
23
|
+
declare function isModuleLoad(model: Construct): boolean;
|
|
24
|
+
declare function unmountModule(model: Construct | PropertyKey): Promise<void>;
|
|
25
25
|
|
|
26
26
|
declare class P {
|
|
27
27
|
constructor();
|
package/dist/index.js
CHANGED
|
@@ -108,23 +108,23 @@ function serializeState() {
|
|
|
108
108
|
return JSON.parse(JSON.stringify(activeInstance.state));
|
|
109
109
|
}
|
|
110
110
|
__name(serializeState, "serializeState");
|
|
111
|
-
function isModuleLoad(
|
|
111
|
+
function isModuleLoad(model) {
|
|
112
112
|
const { origin, state } = getActiveInstance();
|
|
113
|
-
const tag = (0, import_phecda_core2.getTag)(
|
|
113
|
+
const tag = (0, import_phecda_core2.getTag)(model);
|
|
114
114
|
if (tag in state) {
|
|
115
|
-
if (origin.get(state[tag]) !==
|
|
116
|
-
throw new Error(`Synonym module: Module taged "${String(tag)}" (but not "${
|
|
115
|
+
if (origin.get(state[tag]) !== model)
|
|
116
|
+
throw new Error(`Synonym module: Module taged "${String(tag)}" (but not "${model.name}") has been loaded before`);
|
|
117
117
|
return true;
|
|
118
118
|
}
|
|
119
119
|
return false;
|
|
120
120
|
}
|
|
121
121
|
__name(isModuleLoad, "isModuleLoad");
|
|
122
|
-
async function unmountModule(
|
|
123
|
-
if (typeof
|
|
124
|
-
|
|
122
|
+
async function unmountModule(model) {
|
|
123
|
+
if (typeof model === "object")
|
|
124
|
+
model = (0, import_phecda_core2.getTag)(model);
|
|
125
125
|
const { state } = getActiveInstance();
|
|
126
|
-
await (0, import_phecda_core2.invokeHandler)("unmount", state[
|
|
127
|
-
delete state[
|
|
126
|
+
await (0, import_phecda_core2.invokeHandler)("unmount", state[model]);
|
|
127
|
+
delete state[model];
|
|
128
128
|
}
|
|
129
129
|
__name(unmountModule, "unmountModule");
|
|
130
130
|
|
package/dist/index.mjs
CHANGED
|
@@ -71,23 +71,23 @@ function serializeState() {
|
|
|
71
71
|
return JSON.parse(JSON.stringify(activeInstance.state));
|
|
72
72
|
}
|
|
73
73
|
__name(serializeState, "serializeState");
|
|
74
|
-
function isModuleLoad(
|
|
74
|
+
function isModuleLoad(model) {
|
|
75
75
|
const { origin, state } = getActiveInstance();
|
|
76
|
-
const tag = getTag(
|
|
76
|
+
const tag = getTag(model);
|
|
77
77
|
if (tag in state) {
|
|
78
|
-
if (origin.get(state[tag]) !==
|
|
79
|
-
throw new Error(`Synonym module: Module taged "${String(tag)}" (but not "${
|
|
78
|
+
if (origin.get(state[tag]) !== model)
|
|
79
|
+
throw new Error(`Synonym module: Module taged "${String(tag)}" (but not "${model.name}") has been loaded before`);
|
|
80
80
|
return true;
|
|
81
81
|
}
|
|
82
82
|
return false;
|
|
83
83
|
}
|
|
84
84
|
__name(isModuleLoad, "isModuleLoad");
|
|
85
|
-
async function unmountModule(
|
|
86
|
-
if (typeof
|
|
87
|
-
|
|
85
|
+
async function unmountModule(model) {
|
|
86
|
+
if (typeof model === "object")
|
|
87
|
+
model = getTag(model);
|
|
88
88
|
const { state } = getActiveInstance();
|
|
89
|
-
await invokeHandler("unmount", state[
|
|
90
|
-
delete state[
|
|
89
|
+
await invokeHandler("unmount", state[model]);
|
|
90
|
+
delete state[model];
|
|
91
91
|
}
|
|
92
92
|
__name(unmountModule, "unmountModule");
|
|
93
93
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-web",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.11",
|
|
4
4
|
"description": "provide web function for phecda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"mitt": "^3.0.0",
|
|
16
|
-
"phecda-core": "3.0.0-beta.
|
|
16
|
+
"phecda-core": "3.0.0-beta.14"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"tsup": "^6.5.0"
|