API 參考

@univerjs/rpc

此 API 頁面目前提供英文內容。程式碼簽名與識別符不隨介面語言變更。

Browser RPC layer for Univer main-thread and worker communication.

TypeScript
import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc'import { UniverRPCMainThreadPlugin } from '@univerjs/rpc'const config: IUniverRPCMainThreadConfig = {  workerURL: new URL('./worker.js', import.meta.url),}univer.registerPlugin(UniverRPCMainThreadPlugin, config)

workerURL is required when the main-thread plugin starts. Build the following worker entry separately and point workerURL to its output.

TypeScript
import { UniverRPCWorkerThreadPlugin } from '@univerjs/rpc'univer.registerPlugin(UniverRPCWorkerThreadPlugin)

IUniverRPCMainThreadConfig

TypeScript
export interface IUniverRPCMainThreadConfig {  workerURL?: string | URL | Worker}

IUniverRPCWorkerThreadConfig

TypeScript
export interface IUniverRPCWorkerThreadConfig {}

你覺得這篇文檔如何?

© 2026 DreamNum Co., Ltd.