@ynhcj/xiaoyi 1.9.5 → 1.9.6
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/runtime.js +6 -5
- package/package.json +1 -1
package/dist/runtime.js
CHANGED
|
@@ -127,13 +127,14 @@ class XiaoYiRuntime {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
exports.XiaoYiRuntime = XiaoYiRuntime;
|
|
130
|
-
// Global runtime instance
|
|
131
|
-
|
|
130
|
+
// Global runtime instance - use global object to survive module reloads
|
|
131
|
+
const GLOBAL_KEY = Symbol.for('__xiaoyi_runtime_instance__');
|
|
132
132
|
function getXiaoYiRuntime() {
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
const g = global;
|
|
134
|
+
if (!g[GLOBAL_KEY]) {
|
|
135
|
+
g[GLOBAL_KEY] = new XiaoYiRuntime();
|
|
135
136
|
}
|
|
136
|
-
return
|
|
137
|
+
return g[GLOBAL_KEY];
|
|
137
138
|
}
|
|
138
139
|
function setXiaoYiRuntime(runtime) {
|
|
139
140
|
getXiaoYiRuntime().setRuntime(runtime);
|