add side stats panel
This commit is contained in:
28
src/lib/layout/selection.svelte.js
Normal file
28
src/lib/layout/selection.svelte.js
Normal file
@@ -0,0 +1,28 @@
|
||||
let selected = $state(new Set());
|
||||
let totalCountries = $state(0);
|
||||
|
||||
export function toggle(id) {
|
||||
const next = new Set(selected);
|
||||
if (next.has(id)) {
|
||||
next.delete(id);
|
||||
} else {
|
||||
next.add(id);
|
||||
}
|
||||
selected = next;
|
||||
}
|
||||
|
||||
export function clearAll() {
|
||||
selected = new Set();
|
||||
}
|
||||
|
||||
export function getSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
export function setTotalCount(n) {
|
||||
totalCountries = n;
|
||||
}
|
||||
|
||||
export function getTotalCount() {
|
||||
return totalCountries;
|
||||
}
|
||||
Reference in New Issue
Block a user