This commit is contained in:
2026-03-11 11:56:46 +08:00
parent ae59fbe68b
commit 7fdbf19951
9 changed files with 613 additions and 12 deletions

View File

@ -4,6 +4,7 @@ import configurator, { ConfiguratorParams } from './components/conf';
import auth from './components/auth';
import { on, off, once, emit } from './event/bus';
import { EventBridge } from './event/bridge';
import { KernelAdapter } from './kernel/Adapter';
declare global {
interface Window {
@ -25,6 +26,7 @@ type InitParams = {
};
let mainApp: MainApp | null = null;
let kernelAdapter: KernelAdapter | null = null;
const kernel = {
// 事件工具,提供给外部订阅/退订
@ -37,6 +39,10 @@ const kernel = {
if (!params) { console.error('params is required'); return; }
mainApp = new MainApp();
kernelAdapter = new KernelAdapter(mainApp);
// 展开转接器的属性和方法到kernel对象
Object.assign(kernel, kernelAdapter);
const container = (typeof params.container === 'string'
? (document.querySelector(params.container) || document.getElementById(params.container))
@ -52,7 +58,7 @@ const kernel = {
await mainApp.Awake();
await mainApp.loadModel();
},
}
};
if (!window.faceSDK) {