1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/packages/unleash-api/lib/eventStore.js

17 lines
393 B
JavaScript
Raw Normal View History

2016-06-18 21:53:18 +02:00
'use strict';
2016-10-26 10:43:11 +02:00
2016-06-18 21:53:18 +02:00
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-09-10 10:35:35 +02:00
return this.eventDb.store(event).then(() => this.emit(event.type, event));
};
module.exports = EventStore;