From 65a040390fe516bfef154cdb8c35fbf1a30f63e7 Mon Sep 17 00:00:00 2001 From: za-liyong002 Date: Mon, 27 Feb 2023 23:48:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9config.onGot=20=E5=92=8C?= =?UTF-8?q?=20editor.onGot=20=E6=96=B9=E6=B3=95=E4=B8=8E=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-core/src/config.ts | 10 ++++------ packages/editor-core/src/editor.ts | 12 +++++------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/packages/editor-core/src/config.ts b/packages/editor-core/src/config.ts index 12ef865ec..ef889e727 100644 --- a/packages/editor-core/src/config.ts +++ b/packages/editor-core/src/config.ts @@ -288,13 +288,11 @@ export class EngineConfig implements IEngineConfig { const val = this.config?.[key]; if (val !== undefined) { fn(val); - return () => {}; - } else { - this.setWait(key, fn); - return () => { - this.delWait(key, fn); - }; } + this.setWait(key, fn); + return () => { + this.delWait(key, fn); + }; } notifyGot(key: string): void { diff --git a/packages/editor-core/src/editor.ts b/packages/editor-core/src/editor.ts index 5fa6bb894..062b7e669 100644 --- a/packages/editor-core/src/editor.ts +++ b/packages/editor-core/src/editor.ts @@ -190,13 +190,11 @@ export class Editor extends (EventEmitter as any) implements IPublicModelEditor const x = this.context.get(keyOrType); if (x !== undefined) { fn(x); - return () => { }; - } else { - this.setWait(keyOrType, fn); - return () => { - this.delWait(keyOrType, fn); - }; } + this.setWait(keyOrType, fn); + return () => { + this.delWait(keyOrType, fn); + }; } register(data: any, key?: IPublicTypeEditorValueKey): void { @@ -328,4 +326,4 @@ export class Editor extends (EventEmitter as any) implements IPublicModelEditor } } -export const commonEvent = new EventBus(new EventEmitter()); \ No newline at end of file +export const commonEvent = new EventBus(new EventEmitter());