/* eslint-disable @typescript-eslint/no-explicit-any */ function debounce void>(fn: T, ms: number): T { let timer: any = null; return function(...args: Parameters) { if (timer) clearTimeout(timer); timer = setTimeout(() => { timer = null; fn.apply(this, args); }, ms); } as T; }; // Prefer an explicit API base provided via environment variable. This allows // the client running in a container to talk to the server by docker service // name (e.g. http://peddlers-of-ketran:8930) while still working when run on // the host where PUBLIC_URL may be appropriate. const envApiBase = process.env.REACT_APP_API_BASE; const publicBase = process.env.PUBLIC_URL || ''; const base = envApiBase || publicBase; const assetsPath = `${publicBase}/assets`; const gamesPath = `${base}`; export { base, debounce, assetsPath, gamesPath };