1
0
James Ketrenos def2afac6d Auto reconnect hooked up
Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
2022-03-11 15:39:55 -08:00

28 lines
569 B
JavaScript

const getPlayerName = (sessions, color) => {
for (let i = 0; i < sessions.length; i++) {
const session = sessions[i];
if (session.color === color) {
return session.name;
}
}
return null;
}
function debounce(fn, ms) {
let timer;
return _ => {
clearTimeout(timer)
timer = setTimeout(_ => {
timer = null
fn.apply(this, arguments)
}, ms)
};
};
const base = process.env.PUBLIC_URL;
const assetsPath = `${base}/assets`;
const gamesPath = `${base}`;
export { base, debounce, assetsPath, gamesPath, getPlayerName };