From ea75fdcb8e619cd077a7f65117616d1258b55fc8 Mon Sep 17 00:00:00 2001 From: Gxkl Date: Fri, 15 Sep 2023 14:17:48 +0800 Subject: [PATCH] feat: add load units function (#153) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ##### Checklist - [ ] `npm test` passes - [ ] tests and/or benchmarks are included - [ ] documentation is changed or added - [ ] commit message follows commit guidelines ##### Affected core subsystem(s) ##### Description of change --- standalone/standalone/src/Runner.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/standalone/standalone/src/Runner.ts b/standalone/standalone/src/Runner.ts index a05969ea..1807b269 100644 --- a/standalone/standalone/src/Runner.ts +++ b/standalone/standalone/src/Runner.ts @@ -134,7 +134,7 @@ export class Runner { LoadUnitLifecycleUtil.registerLifecycle(this.loadUnitMultiInstanceProtoHook); } - async init() { + async load() { StandaloneContextHandler.register(); LoadUnitFactory.registerLoadUnitCreator(StandaloneLoadUnitType, () => { return new StandaloneLoadUnit(this.innerObjects); @@ -146,8 +146,11 @@ export class Runner { }, }); const loadUnits = await this.loadUnitLoader.load(); - this.loadUnits = [ standaloneLoadUnit, ...loadUnits ]; + return [ standaloneLoadUnit, ...loadUnits ]; + } + async init() { + this.loadUnits = await this.load(); const instances: LoadUnitInstance[] = []; for (const loadUnit of this.loadUnits) { const instance = await LoadUnitInstanceFactory.createLoadUnitInstance(loadUnit);