ViewStateResult
Official
The result of the view state.
Import:
import type { ViewStateResult } from 'obsidian';Signature:
export interface ViewStateResultProperties
| Property | Type | Description | |
|---|---|---|---|
| close? | boolean | Set this to true to indicate that the view cannot show what it was given, so the leaf should put its empty view back. FileView.setState sets it whenever the view is left with no file and FileView.allowNoFile is off, and WorkspaceLeaf.setViewState answers it by opening the leaf's empty view.WorkspaceLeaf.setViewState initializes it to false, so a View.setState implementation is always handed it already present. | |
| history | boolean | Set this to true to indicate that there is a state change which should be recorded in the navigation history. | |
| layout? | boolean | Set this to true to indicate that the state change alters the layout. FileView.setState sets it alongside ViewStateResult.history whenever the loaded file actually changed, and WorkspaceLeaf.setViewState answers it with Workspace.onLayoutChange.WorkspaceLeaf.setViewState initializes it to false, so a View.setState implementation is always handed it already present. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| done() | void | A callback the leaf runs last, after the navigation history has been recorded. FileView.setState sets it to () => this.syncState(), which is the linked-pane follow.Unlike the other three members this one is never initialized — it is absent until a view assigns it. |