summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-12-14 21:43:02 +0300
committerAndrew Dolgov <[email protected]>2021-12-14 21:43:02 +0300
commit8a645892a60bc3181f598d2192f01cc21f35b719 (patch)
tree93c51bee539e6c48616425872309ba5a176c64eb /js
parent3ef9bb5b58a19028c4755e1f5f14c38dd3a09eb7 (diff)
PluginHost: add run_until() and HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM2
Diffstat (limited to 'js')
-rw-r--r--js/PluginHost.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/js/PluginHost.js b/js/PluginHost.js
index deb7c0645..513429e4a 100644
--- a/js/PluginHost.js
+++ b/js/PluginHost.js
@@ -21,6 +21,7 @@ const PluginHost = {
HOOK_HEADLINE_MUTATIONS_SYNCED: 16,
HOOK_HEADLINES_RENDERED: 17,
HOOK_HEADLINES_SCROLL_HANDLER: 18,
+ HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM2: 19,
hooks: [],
register: function (name, callback) {
if (typeof(this.hooks[name]) == 'undefined')
@@ -36,6 +37,17 @@ const PluginHost = {
this.hooks[name][i](args);
}
},
+ run_until: function (name, check, ...args) {
+ //console.warn('PluginHost.run_until', name, check, args);
+
+ if (typeof(this.hooks[name]) != 'undefined')
+ for (let i = 0; i < this.hooks[name].length; i++) {
+ if (this.hooks[name][i](args) == check)
+ return true;
+ }
+
+ return false;
+ },
unregister: function (name, callback) {
for (let i = 0; i < this.hooks[name].length; i++)
if (this.hooks[name][i] == callback)