Back

Version 17

8/28/2024
import parseMetaURL from "https://esm.town/v/jrmann100/parseMetaURL";
import { blob } from "https://esm.town/v/std/blob";
import { whoami } from "https://esm.town/v/stevekrouse/whoami?v=11";

export default <T,>() => {
const storageKey = whoami()[0];
return {
get() {
return blob.getJSON(this.storageKey) as Promise<T | undefined>;
},
set(value: T | undefined) {
if (value === undefined) {
return blob.delete(this.storageKey);
}
return blob.setJSON(this.storageKey, value);
},
};
};
Updated: August 31, 2024