@tmagic/stage 1.5.8 → 1.5.10

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.
@@ -2310,6 +2310,9 @@ class StageRender extends EventEmitter$1 {
2310
2310
  getMagicApi = () => ({
2311
2311
  onPageElUpdate: (el) => this.emit("page-el-update", el),
2312
2312
  onRuntimeReady: (runtime) => {
2313
+ if (this.runtime) {
2314
+ return;
2315
+ }
2313
2316
  this.runtime = runtime;
2314
2317
  globalThis.runtime = runtime;
2315
2318
  this.emit("runtime-ready", runtime);
@@ -4783,6 +4783,9 @@
4783
4783
  getMagicApi = () => ({
4784
4784
  onPageElUpdate: (el) => this.emit("page-el-update", el),
4785
4785
  onRuntimeReady: (runtime) => {
4786
+ if (this.runtime) {
4787
+ return;
4788
+ }
4786
4789
  this.runtime = runtime;
4787
4790
  globalThis.runtime = runtime;
4788
4791
  this.emit("runtime-ready", runtime);
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.5.8",
2
+ "version": "1.5.10",
3
3
  "name": "@tmagic/stage",
4
4
  "type": "module",
5
5
  "main": "dist/tmagic-stage.umd.cjs",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "peerDependencies": {
44
44
  "typescript": "*",
45
- "@tmagic/core": "1.5.8"
45
+ "@tmagic/core": "1.5.10"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "typescript": {
@@ -56,6 +56,10 @@ export default class StageRender extends EventEmitter {
56
56
  public getMagicApi = () => ({
57
57
  onPageElUpdate: (el: HTMLElement) => this.emit('page-el-update', el),
58
58
  onRuntimeReady: (runtime: Runtime) => {
59
+ if (this.runtime) {
60
+ return;
61
+ }
62
+
59
63
  this.runtime = runtime;
60
64
  // @ts-ignore
61
65
  globalThis.runtime = runtime;
package/src/types.ts CHANGED
@@ -210,6 +210,7 @@ export interface Runtime {
210
210
  update?: (data: UpdateData) => void;
211
211
  sortNode?: (data: SortEventData) => void;
212
212
  remove?: (data: RemoveData) => void;
213
+ [key: string]: any;
213
214
  }
214
215
 
215
216
  export interface Magic {
package/types/index.d.ts CHANGED
@@ -314,6 +314,7 @@ interface Runtime {
314
314
  update?: (data: UpdateData) => void;
315
315
  sortNode?: (data: SortEventData) => void;
316
316
  remove?: (data: RemoveData) => void;
317
+ [key: string]: any;
317
318
  }
318
319
  interface Magic {
319
320
  /** 当前页面的根节点变化时调用该方法,编辑器会同步该el和stage的大小,该方法由stage注入到iframe.contentWindow中 */