summaryrefslogtreecommitdiffhomepage
path: root/js/src/tool/util
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-05-19 19:29:38 -0400
committerDax Raad <[email protected]>2025-05-26 12:40:17 -0400
commit2437ce3f8b79a7f9d987862b633f3340bfa2c1c4 (patch)
treed46690ea1bf8043871e26b6139f96997b16a6252 /js/src/tool/util
parentfa8a46326afa2d7fbb592542abf243f248cb5992 (diff)
downloadopencode-2437ce3f8b79a7f9d987862b633f3340bfa2c1c4.tar.gz
opencode-2437ce3f8b79a7f9d987862b633f3340bfa2c1c4.zip
toolz
Diffstat (limited to 'js/src/tool/util')
-rw-r--r--js/src/tool/util/file-times.ts20
1 files changed, 20 insertions, 0 deletions
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<string, Date>(),
+ write: new Map<string, Date>(),
+ }));
+
+ 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;
+ }
+}