Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat(rpc): allow passing an existing Worker (#932)
白熱64f77341f2ac
diff --git a/packages/rpc/src/plugin.ts b/packages/rpc/src/plugin.tsindex aa2f4a38aa..4240ff1cb9 100644--- a/packages/rpc/src/plugin.ts+++ b/packages/rpc/src/plugin.ts@@ -33,7 +33,7 @@ import {} from './services/rpc/implementations/web-worker-rpc.service';export interface IUniverRPCMainThreadConfig {- workerURL: string | URL;+ workerURL: string | URL | Worker;}/**@@ -51,7 +51,8 @@ export class UniverRPCMainThreadPlugin extends Plugin {}override async onStarting(injector: Injector): Promise<void> {- const worker = new Worker(this._config.workerURL);+ const { workerURL } = this._config;+ const worker = workerURL instanceof Worker ? workerURL : new Worker(workerURL);const messageProtocol = createWebWorkerMessagePortOnMain(worker);const dependencies: Dependency[] = [[