2025-11-02 23:26:28 +02:00
|
|
|
export function getGame(url = window.location.href) {
|
2025-11-02 22:56:37 +02:00
|
|
|
let last = url.lastIndexOf("/", url.length);
|
|
|
|
|
let first = url.lastIndexOf("/", last - 1) + 1;
|
|
|
|
|
return url.substring(first, last);
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-25 02:15:27 +03:00
|
|
|
export function debounce(callback, wait = 300) {
|
2025-02-10 00:57:14 +02:00
|
|
|
let timeoutId = null;
|
|
|
|
|
return (...args) => {
|
|
|
|
|
window.clearTimeout(timeoutId);
|
|
|
|
|
timeoutId = window.setTimeout(() => {
|
|
|
|
|
callback(...args);
|
|
|
|
|
}, wait);
|
|
|
|
|
};
|
|
|
|
|
}
|