Skip to content

Commit

Permalink
Fix invoking flagUsed. (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
kinyoklion authored Oct 17, 2022
1 parent 803a63a commit aefe3d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/InspectorManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ function InspectorManager(inspectors, logger) {
manager.onFlagChanged = (flagKey, flag) => {
if (inspectorsByType[InspectorTypes.flagDetailChanged].length) {
onNextTick(() => {
console.log('what?');
inspectorsByType[InspectorTypes.flagDetailChanged].forEach(inspector => inspector.method(flagKey, flag));
});
}
Expand Down
8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ function initialize(env, user, specifiedOptions, platform, extraOptionDefs) {
}
}

function notifyInspectionFlagUsed(key, detail) {
if (inspectorManager.hasListeners(InspectorTypes.flagUsed)) {
inspectorManager.onFlagUsed(key, detail, ident.getUser());
}
}

function notifyInspectionIdentityChanged() {
if (inspectorManager.hasListeners(InspectorTypes.clientIdentityChanged)) {
inspectorManager.onIdentityChanged(ident.getUser());
Expand Down Expand Up @@ -312,7 +318,7 @@ function initialize(env, user, specifiedOptions, platform, extraOptionDefs) {

// For the all flags case `onFlags` will be called instead.
if (!isAllFlags) {
notifyInspectionIdentityChanged();
notifyInspectionFlagUsed(key, detail);
}

return detail;
Expand Down

0 comments on commit aefe3d3

Please sign in to comment.