Skip to content

MetadataCache.iterateRefsForFile method

MetadataCache › iterateRefsForFile

Unofficial

Iterate over all references for a specific file.

The callback is invoked with each reference found in the file, frontmatter links first, so the reference is not necessarily a obsidian#ReferenceCache and may carry no position. Returning true from it stops the iteration.

Signature:

iterateRefsForFile(file: TFile, callback: (reference: Reference) => boolean | void): void

Parameters:

ParameterTypeDescription
fileTFileThe file to iterate references for.
callback(reference: Reference) => boolean | voidThe callback to execute for each reference.

Returns: void