Skip to main content

Saving state

This section describes how to serialize a Dockview instance.

onDidLayoutChange
Invoked when any layout change occures, an aggregation of many events.
onDidLayoutChange: Event<void>
toJSON
Create a serialized object of the current component.
toJSON(): SerializedDockview

To retrieve the current state of Dockview call toJSON(). You can listen to the event onDidLayoutChange to determine when the layout has changed. The event's reasons set says what changed ('geometry', 'structure', 'activePanel', 'panelTitle' or 'panelParameters'), should you want to persist some changes and not others.

See also​

  • Loading state: restore a serialized layout with fromJSON.
  • Layout history: undo and redo layout changes without a full save and restore.