1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/packages/unleash-api/lib/eventStore.js

18 lines
409 B
JavaScript
Raw Normal View History

2016-06-18 21:53:18 +02:00
'use strict';
const util = require('util');
const EventEmitter = require('events').EventEmitter;
2016-07-02 11:54:50 +02:00
function EventStore (eventDb) {
this.eventDb = eventDb;
EventEmitter.call(this);
}
2014-10-22 16:26:36 +02:00
util.inherits(EventStore, EventEmitter);
2014-10-23 10:32:13 +02:00
EventStore.prototype.create = function (event) {
2016-06-18 21:53:18 +02:00
return this.eventDb.store(event).then(() => {
2016-06-18 22:23:19 +02:00
this.emit(event.type, event);
});
};
module.exports = EventStore;