mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
17c8fe7710
fixes: #587 Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
26 lines
463 B
JavaScript
26 lines
463 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();
|
|
}
|
|
|
|
getEvents() {
|
|
return Promise.resolve(this.events);
|
|
}
|
|
}
|
|
|
|
module.exports = () => {
|
|
return new EventStore();
|
|
};
|