]> git.r.bdr.sh - rbdr/corona-regeln/blame - src/lib/stores/rules.js
Port to svelte
[rbdr/corona-regeln] / src / lib / stores / rules.js
CommitLineData
5d9f7190
RBR
1import { readable } from 'svelte/store';
2import { generate } from '$lib/rule_generator';
3
4const internals = {
5 ruleCount: 4
6};
7
8export const getRules = function () {
9
10 return readable([], function (set) {
11
12 (async function() {
13
14 const rules = [];
15 for (let i = 0; i < internals.ruleCount; ++i) {
16 rules.push(await generate());
17 }
18
19 set(rules.sort(() => Math.random() - 0.5));
20 })();
21
22 return function stop() {};
23 });
24};