1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/lib/util/anyEventEmitter.ts
olav e8d542af0f
feat: embed proxy endpoints (#1926)
* refactor: remove unused API definition routes

* feat: add support for proxy keys

* feat: support listening for any event

* feat: embed proxy endpoints

* refactor: add an experimental flag for the embedded proxy
2022-08-16 15:33:33 +02:00

13 lines
410 B
TypeScript

import EventEmitter from 'events';
export const ANY_EVENT = '*';
// Extends the built-in EventEmitter with support for listening for any event.
// See https://stackoverflow.com/a/54431931.
export class AnyEventEmitter extends EventEmitter {
emit(type: string, ...args: any[]): boolean {
super.emit(ANY_EVENT, ...args);
return super.emit(type, ...args) || super.emit('', ...args);
}
}