Skip to content

Vault.on('delete') method

Vault › on(‘delete’)

Official

Called when a file is deleted.

Signature:

on(name: "delete", callback: (file: TAbstractFile) => unknown, ctx?: unknown): EventRef

Parameters:

Parameter Type Description
name "delete" Should be 'delete'.
callback (file: TAbstractFile) => unknown The callback function.
ctx? unknown The context passed as this to the callback function.

Returns: EventRefThe event reference.

Example:

app.vault.on('delete', (file) => {
console.log(file);
});