mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 14:05:46 +01:00
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:
@@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user