fantasy-console/cart.ts

16 lines
445 B
TypeScript
Raw Normal View History

2023-05-02 17:06:54 -07:00
import fakeCart from "./cart_unpacked.json" assert { type: "json" };
2023-05-05 14:59:52 -07:00
import { Sheet } from "./sheet.ts";
2023-05-02 17:06:54 -07:00
2023-05-06 15:12:42 -07:00
let cart = fakeCart as Array<Sheet>;
2023-05-02 17:06:54 -07:00
2023-05-06 15:12:42 -07:00
export const saveCart = async (fname: string) => {
await Deno.writeTextFile("./carts/"+fname+".fx", JSON.stringify(getCart()));
}
export const loadCart = async (fname: string) => {
cart = JSON.parse(await Deno.readTextFile("./carts/"+fname+".fx"));
2023-05-02 17:06:54 -07:00
}
export const getCart = () => {
return cart;
}