Initial docs (#61)

Add initial documentation site.

Co-authored-by: ambiguous48 <33713262+ambiguous48@users.noreply.github.com>
This commit is contained in:
rgossiaux
2022-03-01 13:14:53 -08:00
committed by GitHub
parent 01954a0693
commit 9b43312735
46 changed files with 6373 additions and 10 deletions

View File

@@ -0,0 +1,24 @@
import { onDestroy } from "svelte";
export function createRunWithCleanup() {
let cleanup: { [key: string]: () => any } = {};
onDestroy(() => {
for (const id in cleanup) {
cleanup[id]();
delete cleanup[id];
}
})
return (fn: () => any, id: string) => {
if (cleanup[id]) {
cleanup[id]();
delete cleanup[id];
}
const result = fn();
if (typeof result === "function") {
cleanup[id] = result;
}
}
}