Feat: Client-side hooks - replace window.trigger (#9679)

* feat/clientside-hooks: replace window.trigger with hooks.fire

* feat(clientside-hooks): Move hooks require to the top

* fix: simplifying complex logical expression

* fix: client-side hook for translator - post-review fixes
This commit is contained in:
Anton Grigoryev
2021-08-13 23:58:37 +03:00
committed by GitHub
parent a850dd2e34
commit 342503e07a
30 changed files with 135 additions and 98 deletions

View File

@@ -7,7 +7,8 @@ define('forum/topic/threadTools', [
'handleBack',
'forum/topic/posts',
'api',
], function (components, translator, handleBack, posts, api) {
'hooks',
], function (components, translator, handleBack, posts, api, hooks) {
var ThreadTools = {};
ThreadTools.init = function (tid, topicContainer) {
@@ -151,7 +152,7 @@ define('forum/topic/threadTools', [
timeout: 5000,
});
$(window).trigger('action:topics.changeWatching', { tid: tid, type: type });
hooks.fire('action:topics.changeWatching', { tid: tid, type: type });
}, () => {
app.alert({
type: 'danger',
@@ -180,7 +181,7 @@ define('forum/topic/threadTools', [
}
app.parseAndTranslate('partials/topic/topic-menu-list', data, function (html) {
dropdownMenu.html(html);
$(window).trigger('action:topic.tools.load', {
hooks.fire('action:topic.tools.load', {
element: dropdownMenu,
});
});