From 44bfbc95292d194f51abf58677b0b595101152cd Mon Sep 17 00:00:00 2001 From: ltGuillaume Date: Tue, 7 May 2019 14:34:15 +0000 Subject: Allow to unregister plugin hooks --- js/PluginHost.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/PluginHost.js b/js/PluginHost.js index 06b79ac5a..71596ad31 100644 --- a/js/PluginHost.js +++ b/js/PluginHost.js @@ -29,6 +29,11 @@ PluginHost = { for (let i = 0; i < this.hooks[name].length; i++) { this.hooks[name][i](args); } + }, + unregister: function (name, callback) { + for (var i = 0; i < this.hooks[name].length; i++) + if (this.hooks[name][i] == callback) + this.hooks[name].splice(i, 1); } }; -- cgit v1.2.3