Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default async function* saveLocal(input) {
if (!(await R.managed)) {
yield* input;
return;
}
try {
const init = localStorage.getItem("counters");
if (init) await load(JSON.parse(init));
} catch (e) {}
for await (const i of input) {
yield i;
if (i.type === "FLUSH") {
const frame = await save();
if (frame) localStorage.setItem("counters", JSON.stringify(frame));
else yield i;
}
}
}
export async function* saveLocal(input) {
if (!(await R.managed)) {
yield* input;
return;
}
try {
const init = localStorage.getItem("boxes");
if (init) {
const state = R.read(JSON.parse(init));
R.context().running = state.running;
state.resume.resume();
await R.abort;
}
} catch (e) {}
for await (const i of addFlush(input)) {
yield i;
if (i.type === "DELETE" || i.type === "DONE") {
let frame;
export default async function* undoRedoMain(input, dispatch) {
yield* (await R.managed) ? main(input, dispatch) : input;
}