Skip to content

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 be null in case the file was not successfully cached previously.

Signature:

on(name: "deleted", callback: (file: TFile, prevCache: CachedMetadata | null) => unknown, ctx?: unknown): EventRef

Parameters:

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: EventRefThe event reference.

Example:

app.metadataCache.on('deleted', (file, prevCache) => {
console.log(file, prevCache);
});