fsb_backbone/server/eventStateChange.js
Martin Donnelly e1d9657e87 init
2021-03-12 07:55:43 +00:00

22 lines
514 B
JavaScript

module.exports = (data, socket) => {
const events = [];
data.category.forEach(category => {
category.subcat.forEach(subcat => {
subcat.event.forEach(event => {
events.push({
active: Math.random() >= 0.5,
id: event.id
});
});
});
});
events.forEach(event =>
setTimeout(() => { socket.emit('eventStateUpdate', event) }, 1000 * (Math.floor(Math.random() * 25) + 1))
);
};