1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/packages/unleash-api/lib/eventStore.js
2016-09-10 10:35:35 +02:00

16 lines
392 B
JavaScript

'use strict';
const util = require('util');
const EventEmitter = require('events').EventEmitter;
function EventStore (eventDb) {
this.eventDb = eventDb;
EventEmitter.call(this);
}
util.inherits(EventStore, EventEmitter);
EventStore.prototype.create = function (event) {
return this.eventDb.store(event).then(() => this.emit(event.type, event));
};
module.exports = EventStore;