Skip to content

RecentFileTracker

Unofficial

Tracks recently opened files for quick access and navigation.

Import:

import type { RecentFileTracker } from '@obsidian-typings/obsidian-public-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

Property Type Description
lastOpenFiles string[] List of last opened file paths, limited to 50.
vault Vault Reference to the obsidian#Vault.
workspace Workspace Reference to the obsidian#Workspace.

Methods

Method Returns Description
addRecentFile(file) void Add a file to the recent files list, if the workspace layout is ready.
collect(file) void Add 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) void Set the last opened files.
onFileCreated(file) void On file create, save file to last opened files.
onFileOpen(prevFile, file) void On file open, save file to last opened files.
onRename(file, oldPath) void On file rename, update file path in last opened files.
serialize() string[] Get last opened files.

Links to this page: