Skip to content

Commit

Permalink
fix: bug where fallback window trigger was not firing if there were n…
Browse files Browse the repository at this point in the history
…o hook listeners attached

... so in essence the backwards compatibility was not working at all.

closes NodeBB/nodebb-plugin-composer-default#147
  • Loading branch information
julianlam committed Mar 4, 2021
1 parent c8b7865 commit 1e57942
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions public/src/modules/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ define('hooks', [], () => {
};

const _fireActionHook = (hookName, data) => {
if (!Hooks.hasListeners(hookName)) {
return;
if (Hooks.hasListeners(hookName)) {
Hooks.loaded[hookName].forEach(listener => listener(data));
}

Hooks.loaded[hookName].forEach(listener => listener(data));

// Backwards compatibility (remove this when we eventually remove jQuery from NodeBB core)
$(window).trigger(hookName, data);
};
Expand Down

0 comments on commit 1e57942

Please sign in to comment.