RenameDeleteHandlerComponent
Component that handles rename and delete events in Obsidian. It listens to rename and delete events and updates links accordingly. It also handles edge cases such as case-only renames and collisions with existing files.
Import:
import { RenameDeleteHandlerComponent } from 'obsidian-dev-utils/obsidian/components/rename-delete-handler-component';Signature:
export class RenameDeleteHandlerComponent extends ComponentExExtends: ComponentEx
Constructor
new RenameDeleteHandlerComponent(params: RenameDeleteHandlerComponentConstructorParams)Creates an instance of RenameDeleteHandlerComponent.
Properties
| Property | Type | Description |
|---|---|---|
| abortSignalComponent | AbortSignalComponent | The abort signal component whose signal cancels in-flight rename operations. |
| app | App | The Obsidian app instance. |
| pluginId | string | The plugin ID used to identify this handler among the registered rename/delete handlers. |
| pluginNoticeComponent | PluginNoticeComponent | The notice component used to report updated links to the user. |
| resourceLockComponent | null | ResourceLockComponent | The resource lock component used to guard link updates, or null if none is used. |
| settingsBuilder | () => Partial<RenameDeleteHandlerSettings> | Builds this plugin's rename/delete handler settings. |
| settingsManager | SettingsManager | The manager that aggregates rename/delete handler settings across registered plugins. |
Methods
| Method | Returns | Description |
|---|---|---|
| [Symbol.dispose]() | void | Disposes of the component. (Inherited from ComponentEx) |
| addChild(component) | TComponent | Adds a child component. Mirrors the native Component.addChild contract: if this component is already loaded, the child is loaded immediately, so child._loaded is set before this method returns even when this component has async load logic. The child's async tail (if any) is sequenced into the load promise so a later loadWithPromises call awaits it.(Inherited from ComponentEx) |
| ensureLoaded() | void | Ensures the component is loaded, throwing if it is not. Use this to guard public methods that register teardown-bearing resources (via Component.register, Component.registerEvent, Component.registerDomEvent, etc.). Registering before load is unsafe: Component.unload is a no-op while the component is not loaded, so any teardown registered beforehand would never run if the component is unloaded without first being loaded.(Inherited from ComponentEx) |
| load() | void | Loads the component. (Inherited from ComponentEx) |
| loadWithPromises() | null | Promise<void> | Loads the component with promises. Unlike load, this method never rejects with an individual error: every failure raised by onloadAsync or a child's load is collected, and once everything settles the returned Promise rejects with a single AggregateError holding all of them. Non-Error throwables are normalized via ErrorWrapper.create.(Inherited from ComponentEx) |
| onload() | void | Loads the component |
| onloadAsync() | Promise<void> | Asynchronously loads the component. Override to add async load logic, which is executed after Component.onload.(Inherited from ComponentEx) |
| registerDisposable(disposable) | TDisposable | Registers a Disposable so it is disposed when this component unloads, and returns it unchanged.The recurring "tie a disposable to the component's lifecycle, then keep using it" idiom: the disposable is disposed on Component.unload (or earlier, if the caller disposes it directly — dispose is expected to be idempotent). Guard with ensureLoaded at the call site when registering before load would be unsafe.(Inherited from ComponentEx) |
| removeChild(component) | TComponent | Removes a child component. (Inherited from ComponentEx) |