Workspace.on('active-leaf-change') method
Workspace › on(‘active-leaf-change’)
Official
Triggered when the active leaf changes.Signature:
on(name: "active-leaf-change", callback: (leaf: WorkspaceLeaf | null) => unknown, ctx?: unknown): EventRefParameters:
| Parameter | Type | Description |
|---|---|---|
| name | "active-leaf-change" | Should be 'active-leaf-change'. |
| callback | (leaf: WorkspaceLeaf | null) => unknown | The callback function. |
| ctx? | unknown | The context passed as this to the callback function. |
Returns: EventRef — The event reference.
Since: 0.10.9
Example:
app.workspace.on('active-leaf-change', (leaf) => { console.log(leaf);});