Vault.on('rename') method
Vault › on(‘rename’)
Official
Called when a file is renamed.Signature:
on(name: "rename", callback: (file: TAbstractFile, oldPath: string) => unknown, ctx?: unknown): EventRefParameters:
| Parameter | Type | Description |
|---|---|---|
| name | "rename" | Should be 'rename'. |
| callback | (file: TAbstractFile, oldPath: string) => unknown | The callback function. |
| ctx? | unknown | The context passed as this to the callback function. |
Returns: EventRef — The event reference.
Example:
app.vault.on('rename', (file, oldPath) => { console.log(file, oldPath);});