Skip to content
Snippets Groups Projects
Commit 8a645892 authored by Andrew Dolgov's avatar Andrew Dolgov
Browse files

PluginHost: add run_until() and HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM2

parent 3ef9bb5b
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,7 @@ const PluginHost = { ...@@ -21,6 +21,7 @@ const PluginHost = {
HOOK_HEADLINE_MUTATIONS_SYNCED: 16, HOOK_HEADLINE_MUTATIONS_SYNCED: 16,
HOOK_HEADLINES_RENDERED: 17, HOOK_HEADLINES_RENDERED: 17,
HOOK_HEADLINES_SCROLL_HANDLER: 18, HOOK_HEADLINES_SCROLL_HANDLER: 18,
HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM2: 19,
hooks: [], hooks: [],
register: function (name, callback) { register: function (name, callback) {
if (typeof(this.hooks[name]) == 'undefined') if (typeof(this.hooks[name]) == 'undefined')
...@@ -36,6 +37,17 @@ const PluginHost = { ...@@ -36,6 +37,17 @@ const PluginHost = {
this.hooks[name][i](args); 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) { unregister: function (name, callback) {
for (let i = 0; i < this.hooks[name].length; i++) for (let i = 0; i < this.hooks[name].length; i++)
if (this.hooks[name][i] == callback) if (this.hooks[name][i] == callback)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment