feat(engine): createEngine 注入参数 + 消除模块级 driver 捕获(迁移阶段1-A1)
- createEngine(options) 支持 driver 注入,新增 engine.setDriver; 缺省保持按平台自动选择的行为 - desktop/common-final/system-extended/window-extended 四文件模块加载时 捕获 defaultEngine.driver 改为惰性 getDriver():非 win32 import 不再抛错 (此前 darwin 上 import 即炸),调用时才触发 platform_unsupported - engine-driver.test 补注入/隔离/后置替换 4 例
This commit is contained in:
1 parent
9b76dc6987
commit
1da00827ac
7 files changed
+111
-48
No files matched your search
@@ -59,10 +59,21 @@ export class RpaEngine {
|
||||
}
|
||||
return this._driver;
|
||||
}
|
||||
/** 注入驱动实现(测试替身或宿主适配器);注入后不再走平台自动选择 */
|
||||
setDriver(driver: AutomationDriver): void {
|
||||
this._driver = driver;
|
||||
}
|
||||
}
|
||||
|
||||
export function createEngine(): RpaEngine {
|
||||
return new RpaEngine();
|
||||
export interface EngineOptions {
|
||||
/** 注入桌面自动化驱动(测试替身或宿主适配器);缺省按 process.platform 自动选择 */
|
||||
driver?: AutomationDriver;
|
||||
}
|
||||
|
||||
export function createEngine(options?: EngineOptions): RpaEngine {
|
||||
const engine = new RpaEngine();
|
||||
if (options?.driver) engine.setDriver(options.driver);
|
||||
return engine;
|
||||
}
|
||||
|
||||
/** 能力模块内部使用的默认引擎实例(与全局注册表配套的进程级单例)。 */
|
||||
|
||||
Reference in new issue
Block a user