CanvasIndex
Unofficial
Index that tracks and resolves links, embeds, and metadata across all canvas files.
Import:
import type { CanvasIndex } from '@obsidian-typings/obsidian-public-latest';Signature:
export interface CanvasIndex extends ComponentExtends: Component
Constructor
new CanvasIndex()Constructor.
To extract the constructor type, use ExtractConstructor<Component>.
Properties
| Property | Type | Description | |
|---|---|---|---|
| _children | Component[] | Child Components attached to current component, will be unloaded on unloading parent component. (Inherited from Component) | |
| _events | EventRef[] | Events that are attached to the current component, will be detached on unloading parent component. (Inherited from Component) | |
| _loaded | boolean | Whether the component and its children are loaded. (Inherited from Component) | |
| app | App | Reference to the Obsidian app instance. | |
| fileQueue | unknown[] | Queue of files waiting to be processed by the indexer. | |
| frame | null | Current animation frame request, or null when idle. | |
| index | Record<string, CanvasIndexEntry> | Index of canvas entries keyed by file path. | |
| refNodeIds | WeakMap<object, unknown> | Weak map tracking reference node IDs for canvas files. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| addChild(component) | T | Adds a child component, loading it if this component is loaded. (Inherited from Component) | |
| canProcess(arg1) | unknown | Check whether a file can be processed by the canvas indexer. | |
| get(arg1) | unknown | Get the index entry for the specified file. | |
| getAll() | unknown | Get all index entries. | |
| getForPath(arg1) | unknown | Get the index entry for the specified file path. | |
| load() | void | Load this component and its children. (Inherited from Component) | |
| onCreate(arg1) | unknown | Handle a file creation event. | |
| onDelete(arg1) | unknown | Handle a file deletion event. | |
| onload() | unknown | Initialize the index when the component loads. | |
| onModify(arg1) | unknown | Handle a file modification event. | |
| onRename(arg1, arg2) | unknown | Handle a file rename event. | |
| onunload() | unknown | Clean up the index when the component unloads. | |
| parseText(arg1) | Promise<unknown> | Parse canvas text content and extract metadata. | |
| process(arg1) | Promise<unknown> | Process a single canvas file and update the index. | |
| queue(arg1) | unknown | Add a file to the processing queue. | |
| register(cb) | void | Registers a callback to be called when unloading. (Inherited from Component) | |
| registerDomEvent(el, type, callback, options?) | void | Registers a DOM event to be detached when unloading. (Inherited from Component) | |
| registerDomEvent(el, type, callback, options?) | void | Registers a DOM event to be detached when unloading (Inherited from Component) | |
| registerDomEvent(el, type, callback, options?) | void | Registers a DOM event to be detached when unloading (Inherited from Component) | |
| registerEvent(eventRef) | void | Registers an event to be detached when unloading. (Inherited from Component) | |
| registerInterval(id) | number | Registers an interval (from setInterval) to be cancelled when unloading. Use window.setInterval instead of setInterval to avoid TypeScript confusing between NodeJS vs Browser API(Inherited from Component) | |
| registerScopeEvent(keymapEventHandler) | void | Register a scope keymap event handler to be removed on unload. (Inherited from Component) | |
| removeChild(component) | T | Removes a child component, unloading it. (Inherited from Component) | |
| requestFrame() | unknown | Request an animation frame to process queued files. | |
| run() | Promise<unknown> | Run the indexer to process all queued files. | |
| unload() | void | Override this to unload your component. (Inherited from Component) |
Links to this page: