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-06-18 21:53:18 +02:00

19 lines
431 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) {
const that = this;
return this.eventDb.store(event).then(() => {
that.emit(event.type, event);
});
};
module.exports = EventStore;