ensl_gathers/lib/event/controller.js

22 lines
405 B
JavaScript
Raw Normal View History

2015-12-29 16:26:11 +00:00
/*
* Events Controller
*
* Server API
* event:append - New event to be added to history
*
*/
const winston = require("winston");
const pubsub = require("./pubsub.js");
module.exports = namespace => {
pubsub.on("newEvent", event => {
if (!event.public) return;
namespace.emit("event:append", {
type: event.type,
description: event.description,
createdAt: event.createdAt
})
});
};