summaryrefslogtreecommitdiffhomepage
path: root/js/src/tool/util
diff options
context:
space:
mode:
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;
+ }
+}