export function getGame(url = window.location.href) { let last = url.lastIndexOf("/", url.length); let first = url.lastIndexOf("/", last - 1) + 1; return url.substring(first, last); } export function debounce(callback, wait = 300) { let timeoutId = null; return (...args) => { window.clearTimeout(timeoutId); timeoutId = window.setTimeout(() => { callback(...args); }, wait); }; }