MetadataCache.on('deleted') method
MetadataCache › on(‘deleted’)
Official
Called when a file has been deleted. A best-effort previous version of the cached metadata is presented, but it could benull in case the file was not successfully cached previously. Signature:
on(name: "deleted", callback: (file: TFile, prevCache: CachedMetadata | null) => unknown, ctx?: unknown): EventRefParameters:
| Parameter | Type | Description |
|---|---|---|
| name | "deleted" | Should be 'deleted'. |
| callback | (file: TFile, prevCache: CachedMetadata | null) => unknown | The callback function. |
| ctx? | unknown | The context passed as this to the callback function. |
Returns: EventRef — The event reference.
Example:
app.metadataCache.on('deleted', (file, prevCache) => { console.log(file, prevCache);});