using obsidian debounce

This commit is contained in:
Zihad 2025-05-05 16:22:22 +06:00
parent 0077135863
commit 70d81c7c18

View file

@ -1,6 +1,5 @@
import { App, Plugin, WorkspaceLeaf, ItemView, TFile } from "obsidian";
import { App, Plugin, WorkspaceLeaf, ItemView, TFile, debounce } from "obsidian";
import { DEFAULT_SETTINGS, EasySettingTab, NoteEntry, EasyKeepViewPluginSettings } from "./settings"; // Import from settings
const VIEW_TYPE_EASY_KEEP = "easy-keep-view";
// Helper function to resolve image by name
@ -15,15 +14,6 @@ function resolveImageByName(app: App, imageName: string): TFile | null {
return null;
}
// Debounce function for throttling updates
function debounce(fn: (...args: any[]) => void, delay = 300): (...args: any[]) => void {
let timer: NodeJS.Timeout;
return (...args: any[]) => {
clearTimeout(timer);
timer = setTimeout(() => fn(...args), delay);
};
}
class EasyKeepView extends ItemView {