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/event-store.js
2020-02-20 08:30:34 +01:00

17 lines
393 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;