mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 03:01:16 +00:00
feat: fix poroject.onSimulatorHostReady in workspace mode
This commit is contained in:
parent
f44b5aca89
commit
bf5fece16b
@ -369,6 +369,10 @@ export class Project implements IProject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onSimulatorReady(fn: (args: any) => void): () => void {
|
onSimulatorReady(fn: (args: any) => void): () => void {
|
||||||
|
if (this._simulator) {
|
||||||
|
fn(this._simulator);
|
||||||
|
return () => {};
|
||||||
|
}
|
||||||
this.emitter.on('lowcode_engine_simulator_ready', fn);
|
this.emitter.on('lowcode_engine_simulator_ready', fn);
|
||||||
return () => {
|
return () => {
|
||||||
this.emitter.removeListener('lowcode_engine_simulator_ready', fn);
|
this.emitter.removeListener('lowcode_engine_simulator_ready', fn);
|
||||||
|
|||||||
@ -192,12 +192,8 @@ export class Project implements IPublicApiProject {
|
|||||||
*/
|
*/
|
||||||
onSimulatorHostReady(fn: (host: IPublicApiSimulatorHost) => void): IPublicTypeDisposable {
|
onSimulatorHostReady(fn: (host: IPublicApiSimulatorHost) => void): IPublicTypeDisposable {
|
||||||
const offFn = this[projectSymbol].onSimulatorReady((simulator: BuiltinSimulatorHost) => {
|
const offFn = this[projectSymbol].onSimulatorReady((simulator: BuiltinSimulatorHost) => {
|
||||||
this[simulatorHostSymbol] = simulator;
|
|
||||||
fn(SimulatorHost.create(simulator)!);
|
fn(SimulatorHost.create(simulator)!);
|
||||||
});
|
});
|
||||||
if (this[simulatorHostSymbol]) {
|
|
||||||
fn(SimulatorHost.create(this[simulatorHostSymbol])!);
|
|
||||||
}
|
|
||||||
return offFn;
|
return offFn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user