blob: 641994b8e9230d0a530d6882e2d7c2474403032c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import { writable } from "svelte/store";
const MAX_MATCHES = 100;
function createMatchHistory() {
const { subscribe, update } = writable([]);
function pushMatch(match: object) {
update((matches) => {
if (matches.length == MAX_MATCHES) {
matches.pop();
}
matches.unshift(match);
return matches;
});
}
return {
subscribe,
pushMatch,
};
}
export const matchHistory = createMatchHistory();
export const selectedOpponent = writable(null);
|