Lifecycle

Global lifecycle

  • Starting: Univer is initializing, and 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 completed its first render switch. Asynchronous content may not be finished.
  • Steady: The standard UI enters this stage after a delay following Rendered. It does not wait for all asynchronous tasks.

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. For example, if plugin B loads after the global stage has reached Ready, B's onReady() runs, but no additional global Ready event is emitted.

When a listener is added, its callback may receive the current stage immediately, including Starting. To determine only the current stage, call univerAPI.getCurrentLifecycleStage() directly.

To remove a listener, use the disposable object that the call returns:

TypeScript
disposable.dispose()

Plugin lifecycle hooks

When a plugin loads, it runs onStarting() and then catches up through the hooks of the current global stage. Load B at a different point in time 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 when they are registered. Business-type plugins usually load before the first unit of that type is constructed. A new plugin for a type that has already started loads in a deferred batch. Explicit dependencies can trigger earlier loading.

Within a batch, hooks are called synchronously, stage by stage, in dependency order. The asynchronous work inside a hook is not awaited. Confirm that a unit, a DOM element, or a resource exists before accessing it.

How is this guide?

© 2026 DreamNum Co., Ltd.