Web Workers

Bases can offload formula calculation to a Worker1 over RPC. Set notExecuteFormula: true on the main thread's formula engine, and register the remote Bases plugin and the calculating engine inside the Worker.

This page starts from installation and basic usage, and the snippets below extend that setup. Register plugins before creating or loading content, and replace an existing registration rather than registering the same plugin twice.

Main thread

UniverRPCMainThreadPlugin

  • workerURL
    string | URL | Worker
    Connects the editor to a Worker that performs formula calculation.

UniverProFormulaEnginePlugin

  • notExecuteFormula
    booleanDefault: false
    Skips formula calculation on the main thread when the Worker performs it.
TypeScript
import { UniverProFormulaEnginePlugin } from '@univerjs-pro/engine-formula'import { UniverRPCMainThreadPlugin } from '@univerjs/rpc'univer.registerPlugin(UniverRPCMainThreadPlugin, {  workerURL: new Worker(new URL('./worker.ts', import.meta.url), { type: 'module' }),})univer.registerPlugin(UniverProFormulaEnginePlugin, { notExecuteFormula: true })

Worker entry

UniverLicensePlugin

  • license
    string
    Contents of the client license file.
TypeScript
import { UniverRemoteBasesPlugin } from '@univerjs-pro/bases/worker'import { UniverProFormulaEnginePlugin } from '@univerjs-pro/engine-formula/worker'import { UniverLicensePlugin } from '@univerjs-pro/license'import { LocaleType, Univer } from '@univerjs/core'import { UniverRPCWorkerThreadPlugin } from '@univerjs/rpc/worker'const univer = new Univer({ locale: LocaleType.EN_US })univer.registerPlugin(UniverLicensePlugin, { license: 'your license.txt' })univer.registerPlugin(UniverProFormulaEnginePlugin)univer.registerPlugin(UniverRemoteBasesPlugin)univer.registerPlugin(UniverRPCWorkerThreadPlugin)

Use a module Worker with its own entry file, and keep package versions identical in the Worker and on the main thread. Rendering and user interaction remain on the main thread.

Pivot views and dashboards

To run dashboard pivot calculation in the Worker, set notExecuteCalculation: true on the main thread's UniverBaseDashboardPlugin and register UniverRemoteBaseDashboardPlugin in the same Worker. Dashboard UI plugins remain on the main thread.

UniverBaseDashboardPlugin

  • notExecuteCalculation
    boolean
    Moves dashboard pivot calculation off the main thread. Set this option to true when using the remote dashboard plugin.
TypeScript
import { UniverBaseDashboardPlugin } from '@univerjs-pro/bases-dashboard'univer.registerPlugin(UniverBaseDashboardPlugin, { notExecuteCalculation: true })
TypeScript
import { UniverRemoteBaseDashboardPlugin } from '@univerjs-pro/bases-dashboard/worker'univer.registerPlugin(UniverRemoteBaseDashboardPlugin)

Footnotes

  1. A Web Worker runs JavaScript outside the browser’s main thread and exchanges messages with it. It cannot access the page DOM directly; moving calculations into a Worker does not move the editor UI there. ↩

How is this guide?

© 2026 DreamNum Co., Ltd.