Skip to main content

Loading state

This section describes loading a dock layout.

onDidLayoutFromJSON
Invoked after a layout is deserialzied using the fromJSON method.
onDidLayoutFromJSON: Event<void>
fromJSON
Create a component from a serialized object.
fromJSON(data: SerializedDockview, options: {
reuseExistingPanels: boolean
}): void

Load a layout

To load a layout you should pass a valid object to fromJSON. If you try to load an invalid or corrupted layout Dockview will throw an error and reset gracefully, ready for another attempt with a valid object.

You could load a previously saved layout from local storage for example.

See also

  • Saving state: serialize the current layout with toJSON.
  • Layout history: undo and redo layout changes without reloading from JSON.