Browse Source

Allow to unregister plugin hooks

ltGuillaume 5 months ago
parent
commit
44bfbc9529
1 changed files with 5 additions and 0 deletions
  1. 5 0
      js/PluginHost.js

+ 5 - 0
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);
 	}
 };