From 2e4b54e86804788c6141fefbda7c1791885c444d Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Fri, 4 Jul 2014 19:38:21 +0100 Subject: [PATCH] helper function for plugins to create new hooks --- code/hooks.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/hooks.js b/code/hooks.js index 1de476f3..1dce5d8e 100644 --- a/code/hooks.js +++ b/code/hooks.js @@ -85,6 +85,13 @@ window.runHooks = function(event, data) { return !interrupted; } +// helper method to allow plugins to create new hooks +window.pluginCreateHook = function(event) { + if($.inArray(event, window.VALID_HOOKS) < 0) { + window.VALID_HOOKS.push(event); + } +} + window.addHook = function(event, callback) { if(VALID_HOOKS.indexOf(event) === -1) {