You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It might be neat to have an API that can be used to tell if some external changes have occurred since the last time a command was run. This would be useful for not doing an action if unnecessary to do so.
consttracker=$.changeTracker(import.meta,"data files");// cache keyed on this current file and a stringtracker.addMtime("data/file1.json");// hashes based on the file path's last modified timetracker.addPath("data/file2.json");// hashes based on the file path's contenttracker.addMtime("some_dir");// hashes based on the descendants mtimetracker.addPath("some_dir");// hashes based on the descendants contentstracker.addValue(123456);// hashes a specific value, which could have a source anywhere else// multiple paths or valuestracker.addPaths(paths);tracker.addMTimes(otherPaths);tracker.addValues(values);// will always run if the output path doesn't existtracker.addOutputPath("output/data.json");// run if changedif(tracker.hasChangedSync()){awaitdoStuff();tracker.commitSync();}// or as a single callawaittracker.runIfChanged(async()=>{awaitdoStuff();});// builder patternawait$.changeTracker(import.meta,"data files").addPaths(paths).addOutputPath("output/data.json").runIfChanged(async()=>{awaitcreateOutputDataJsonFile();});
The hash could be saved in local storage.
The text was updated successfully, but these errors were encountered:
It might be neat to have an API that can be used to tell if some external changes have occurred since the last time a command was run. This would be useful for not doing an action if unnecessary to do so.
The hash could be saved in local storage.
The text was updated successfully, but these errors were encountered: