mirror of
https://github.com/sr229/kuru-kuru.git
synced 2024-09-20 12:10:33 +00:00
18 lines
366 B
TypeScript
18 lines
366 B
TypeScript
|
const kv = await Deno.openKv();
|
||
|
|
||
|
export function getGlobalStatistics(): number {
|
||
|
let res = 0;
|
||
|
kv.get<number>(["global-statistics"]).then(v => {
|
||
|
res = v.value as number;
|
||
|
});
|
||
|
|
||
|
return res;
|
||
|
}
|
||
|
|
||
|
export function setGlobalStatistics(value: number) {
|
||
|
const pv = getGlobalStatistics();
|
||
|
kv.set(["global-statistics"], pv + value).then(() => {
|
||
|
return;
|
||
|
})
|
||
|
}
|