Skip to content

RecentFileTracker

Unofficial

Tracks recently opened files for quick access and navigation.

Import:

import type { RecentFileTracker } from '@obsidian-typings/obsidian-catalyst-latest';

Signature:

export interface RecentFileTracker

Constructor

new RecentFileTracker(workspace: Workspace, vault: Vault)

Constructor.

To get the constructor instance, use getRecentFileTrackerConstructor from obsidian-typings/implementations.

Properties

PropertyTypeDescription
lastOpenFilesstring[]List of last opened file paths, limited to 50.
vaultVaultReference to the obsidian#Vault.
workspaceWorkspaceReference to the obsidian#Workspace.

Methods

MethodReturnsDescription
addRecentFile(file)voidAdd a file to the recent files list, if the workspace layout is ready.
collect(file)voidAdd a file to the recent files list.
getLastOpenFiles()string[]Returns the last 10 opened files.
getRecentFiles(options?)string[]Get last n files of type (defaults to 10).
load(savedFiles)voidSet the last opened files.
onFileCreated(file)voidOn file create, save file to last opened files.
onFileOpen(prevFile, file)voidOn file open, save file to last opened files.
onRename(file, oldPath)voidOn file rename, update file path in last opened files.
serialize()string[]Get last opened files.

Links to this page: