Skip to content

Commit bf5fece

Browse files
liujupingJackLian
authored andcommitted
feat: fix poroject.onSimulatorHostReady in workspace mode
1 parent f44b5ac commit bf5fece

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/designer/src/project/project.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ export class Project implements IProject {
369369
}
370370

371371
onSimulatorReady(fn: (args: any) => void): () => void {
372+
if (this._simulator) {
373+
fn(this._simulator);
374+
return () => {};
375+
}
372376
this.emitter.on('lowcode_engine_simulator_ready', fn);
373377
return () => {
374378
this.emitter.removeListener('lowcode_engine_simulator_ready', fn);

packages/shell/src/api/project.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,8 @@ export class Project implements IPublicApiProject {
192192
*/
193193
onSimulatorHostReady(fn: (host: IPublicApiSimulatorHost) => void): IPublicTypeDisposable {
194194
const offFn = this[projectSymbol].onSimulatorReady((simulator: BuiltinSimulatorHost) => {
195-
this[simulatorHostSymbol] = simulator;
196195
fn(SimulatorHost.create(simulator)!);
197196
});
198-
if (this[simulatorHostSymbol]) {
199-
fn(SimulatorHost.create(this[simulatorHostSymbol])!);
200-
}
201197
return offFn;
202198
}
203199

0 commit comments

Comments
 (0)