From 2437ce3f8b79a7f9d987862b633f3340bfa2c1c4 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Mon, 19 May 2025 19:29:38 -0400 Subject: toolz --- js/src/tool/util/file-times.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 js/src/tool/util/file-times.ts (limited to 'js/src/tool/util') diff --git a/js/src/tool/util/file-times.ts b/js/src/tool/util/file-times.ts new file mode 100644 index 000000000..d07c5264c --- /dev/null +++ b/js/src/tool/util/file-times.ts @@ -0,0 +1,20 @@ +import { App } from "../../app"; + +export namespace FileTimes { + export const state = App.state("tool.edit", () => ({ + read: new Map(), + write: new Map(), + })); + + export function read(filePath: string) { + state().read.set(filePath, new Date()); + } + + export function write(filePath: string) { + state().write.set(filePath, new Date()); + } + + export function get(filePath: string): Date | null { + return state().read.get(filePath) || null; + } +} -- cgit v1.2.3