mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-07 01:16:28 +02:00
19 lines
431 B
JavaScript
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;
|