1
0
Fork 0

:sprakles: Support for bundled hooks

This commit is contained in:
Joost De Cock 2018-08-11 14:03:06 +02:00
parent 0207fe35f8
commit a4854735b9

View file

@ -215,6 +215,10 @@ Pattern.prototype.loadPluginHooks = function(plugin) {
for (let hook of this.hooks.all) { for (let hook of this.hooks.all) {
if (typeof plugin.hooks[hook] === "function") { if (typeof plugin.hooks[hook] === "function") {
this.on(hook, plugin.hooks[hook]); this.on(hook, plugin.hooks[hook]);
} else if (typeof plugin.hooks[hook] === "array") {
for (let method of plugin.hooks[hook]) {
this.on(hook, method);
}
} }
} }
}; };