Lifecycle

Global lifecycle

  • Starting: Univer is initializing; no business unit exists yet.
  • Ready: The first business unit has been created. Later units do not trigger this stage again.
  • Rendered: The standard UI has performed its first render switch. Asynchronous content may not be loaded yet.
  • Steady: The standard UI reaches this stage after a delay following Rendered. It does not wait for asynchronous tasks to finish.

Facade API

TypeScript
const currentStage = univerAPI.getCurrentLifecycleStage()const disposable = univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {  console.log(stage)})

What the event reports

LifeCycleChanged reports the global stage of Univer. If plugin B loads after the global Ready stage, B still calls onReady(), but no additional global Ready event is emitted.

A listener can receive the current stage immediately after it is added, including Starting. To read only the current stage, call univerAPI.getCurrentLifecycleStage() directly.

To remove a listener, dispose the returned disposable object:

TypeScript
disposable.dispose()

Plugin lifecycle hooks

A plugin runs onStarting() when it loads, and then catches up to the current global stage. Change the load time of B to compare its hook calls with those of A.

Load B at · Rendered
StartingGlobalPlugin ANot loadedLoadStartingReadyRenderedSteadyPlugin BNot loadedLoadStartingReadyRenderedSteady
Global: StartingGlobal: Starting · 1 / 14

Slowed down to show synchronous hook calls.

General plugins load at registration. Business-type plugins usually load before the first unit of that type is constructed. For a type that has already started, new plugins of that type load in a deferred batch. Explicit dependencies can cause a plugin to load earlier.

Hooks in a batch run synchronously, stage by stage and in dependency order, and do not await asynchronous work inside them. Confirm that the relevant unit, DOM element, or resource is ready before you access it.

How is this guide?

© 2026 DreamNum Co., Ltd.