nice update
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { getIO } from './realtime.js';
|
||||
|
||||
const MAX_FEED = 40;
|
||||
const feed = [];
|
||||
|
||||
export function getDropFeed() {
|
||||
return [...feed];
|
||||
}
|
||||
|
||||
export function pushDrop(entry) {
|
||||
const event = {
|
||||
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
||||
at: new Date().toISOString(),
|
||||
...entry,
|
||||
};
|
||||
feed.unshift(event);
|
||||
if (feed.length > MAX_FEED) feed.length = MAX_FEED;
|
||||
|
||||
const io = getIO();
|
||||
if (io) io.to('feed').emit('feed:drop', event);
|
||||
return event;
|
||||
}
|
||||
Reference in New Issue
Block a user