toolz
This commit is contained in:
20
js/src/tool/util/file-times.ts
Normal file
20
js/src/tool/util/file-times.ts
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user