Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function load(from, param) {
if (!from) return;
const state = R.read(from.resume);
R.context().running = state.running;
state.resume.resume(param);
await R.abort;
}
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;
const resume = await R.idle;
if (resume && resume.resume) {
frame = R.write({ running: R.context().running, resume });
localStorage.setItem("boxes", JSON.stringify(frame));
}
}
}
}