mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
ff7be7696c
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
27 lines
691 B
TypeScript
27 lines
691 B
TypeScript
import EventEmitter from 'events';
|
|
import { EventHook } from './types/option';
|
|
import {
|
|
FEATURE_CREATED,
|
|
FEATURE_UPDATED,
|
|
FEATURE_ARCHIVED,
|
|
FEATURE_REVIVED,
|
|
} from './types/events';
|
|
|
|
export const addEventHook = (
|
|
eventHook: EventHook,
|
|
eventStore: EventEmitter,
|
|
): void => {
|
|
eventStore.on(FEATURE_CREATED, (data) => {
|
|
eventHook(FEATURE_CREATED, data);
|
|
});
|
|
eventStore.on(FEATURE_UPDATED, (data) => {
|
|
eventHook(FEATURE_UPDATED, data);
|
|
});
|
|
eventStore.on(FEATURE_ARCHIVED, (data) => {
|
|
eventHook(FEATURE_ARCHIVED, data);
|
|
});
|
|
eventStore.on(FEATURE_REVIVED, (data) => {
|
|
eventHook(FEATURE_REVIVED, data);
|
|
});
|
|
};
|