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:

ParameterTypeDescription
name"deleted"Should be 'deleted'.
callback(file: TFile, prevCache: CachedMetadata | null) => unknownThe callback function.
ctx?unknownThe context passed as this to the callback function.

Returns: EventRefThe event reference.

Example:

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