Pause when tab is hidden, using visibility change api

This commit is contained in:
Renan LE CARO 2025-03-15 10:34:01 +01:00
parent 1a56b5f1d1
commit 33d74e8c84
68 changed files with 7290 additions and 6933 deletions

View file

@ -1,19 +1,17 @@
import {RawLevel} from "./types";
import { RawLevel } from "./types";
import _backgrounds from "./backgrounds.json";
const backgrounds = _backgrounds as string[];
export function getLevelBackground(level:RawLevel){
export function getLevelBackground(level: RawLevel) {
let svg = level.svg !== null && backgrounds[level.svg % backgrounds.length];
let svg = level.svg !== null && backgrounds[level.svg % backgrounds.length];
if (!level.color && !svg) {
svg = backgrounds[hashCode(level.name) % backgrounds.length];
}
return svg
if (!level.color && !svg) {
svg = backgrounds[hashCode(level.name) % backgrounds.length];
}
return svg;
}
export function hashCode(string: string) {
let hash = 0;
for (let i = 0; i < string.length; i++) {