mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
d917e8018f
* Add option and functionality that allows a user to hook into feature mutations. * Fix function argument to include the entire event.
24 lines
575 B
JavaScript
24 lines
575 B
JavaScript
'use strict';
|
|
|
|
const {
|
|
FEATURE_CREATED,
|
|
FEATURE_UPDATED,
|
|
FEATURE_ARCHIVED,
|
|
FEATURE_REVIVED,
|
|
} = require('./event-type');
|
|
|
|
exports.addEventHook = (eventHook, eventStore) => {
|
|
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);
|
|
});
|
|
};
|