mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
gahew
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// alert Service
|
||||
// Purpose: Defines the alert Service module and the helpers/state used by this service unit.
|
||||
// Scope: Keeps runtime behavior unchanged while isolating responsibilities into a clear module boundary.
|
||||
const io = require('../../globals/io');
|
||||
|
||||
function sendAlert({ color, title, message, ts = Date.now() }) {
|
||||
const payload = {
|
||||
color: color || '#2196f3',
|
||||
title,
|
||||
message,
|
||||
ts,
|
||||
};
|
||||
io.emit('alert', payload);
|
||||
io.emit('alert:new', { id: `${ts}-${Math.random().toString(36).slice(2)}`, ...payload });
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
sendAlert,
|
||||
};
|
||||
Reference in New Issue
Block a user