mirror of
https://github.com/Unleash/unleash.git
synced 2024-11-01 19:07:38 +01:00
289cf85a3c
* Add import/export for tags and projects Tags includes (tags, tag-types and feature-tags) fixes: #752
32 lines
626 B
JavaScript
32 lines
626 B
JavaScript
'use strict';
|
|
|
|
const { EventEmitter } = require('events');
|
|
|
|
class EventStore extends EventEmitter {
|
|
constructor() {
|
|
super();
|
|
this.setMaxListeners(0);
|
|
this.events = [];
|
|
}
|
|
|
|
store(event) {
|
|
this.events.push(event);
|
|
this.emit(event.type, event);
|
|
return Promise.resolve();
|
|
}
|
|
|
|
batchStore(events) {
|
|
events.forEach(event => {
|
|
this.events.push(event);
|
|
this.emit(event.type, event);
|
|
});
|
|
return Promise.resolve();
|
|
}
|
|
|
|
getEvents() {
|
|
return Promise.resolve(this.events);
|
|
}
|
|
}
|
|
|
|
module.exports = EventStore;
|