Zachatoo / obsidian-achievements

Add achievements to Obsidian to help guide the user to build good habits in Obsidian.
MIT License
22 stars 0 forks source link

Change how links are retrieved from metadata cache #9

Closed Zachatoo closed 1 year ago

Zachatoo commented 1 year ago

Need to replace this undocumented Obsidian function with one from the public api.

// before
return this.app.fileManager.getAllLinkResolutions().length;

// after
let count = 0;
this.app.metadataCache.iterateReferences((sourcePath: string, reference: ReferenceCache) => {
  count++;
});
return count;

Should also remove the typescript declaration for this undocumented Obsidian function.