summaryrefslogtreecommitdiff
path: root/src/static/js
diff options
context:
space:
mode:
authorChad Weider <cweider@oofn.net>2012-05-28 18:58:55 -0700
committerChad Weider <cweider@oofn.net>2012-09-11 21:16:47 -0700
commit93944953640cc2fd2af05f63cd32b809ca2b7e6b (patch)
tree5d5bbf7d3eaf80838d0e6e60623546e29aa91bee /src/static/js
parent3631f0ece3abb0f40ca368a2133ee3397f12a617 (diff)
downloadetherpad-lite-93944953640cc2fd2af05f63cd32b809ca2b7e6b.zip
Inject plugins into hooks.
Diffstat (limited to 'src/static/js')
-rw-r--r--src/static/js/pluginfw/hooks.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/static/js/pluginfw/hooks.js b/src/static/js/pluginfw/hooks.js
index 44f5fc3f..d9a14d85 100644
--- a/src/static/js/pluginfw/hooks.js
+++ b/src/static/js/pluginfw/hooks.js
@@ -1,4 +1,3 @@
-var plugins = require("./plugins");
var async = require("async");
var _ = require("underscore");
@@ -71,8 +70,8 @@ exports.flatten = function (lst) {
exports.callAll = function (hook_name, args) {
if (!args) args = {};
- if (plugins.hooks[hook_name] === undefined) return [];
- return _.flatten(_.map(plugins.hooks[hook_name], function (hook) {
+ if (exports.plugins.hooks[hook_name] === undefined) return [];
+ return _.flatten(_.map(exports.plugins.hooks[hook_name], function (hook) {
return hookCallWrapper(hook, hook_name, args);
}), true);
}
@@ -80,9 +79,9 @@ exports.callAll = function (hook_name, args) {
exports.aCallAll = function (hook_name, args, cb) {
if (!args) args = {};
if (!cb) cb = function () {};
- if (plugins.hooks[hook_name] === undefined) return cb(null, []);
+ if (exports.plugins.hooks[hook_name] === undefined) return cb(null, []);
async.map(
- plugins.hooks[hook_name],
+ exports.plugins.hooks[hook_name],
function (hook, cb) {
hookCallWrapper(hook, hook_name, args, function (res) { cb(null, res); });
},
@@ -94,8 +93,8 @@ exports.aCallAll = function (hook_name, args, cb) {
exports.callFirst = function (hook_name, args) {
if (!args) args = {};
- if (plugins.hooks[hook_name] === undefined) return [];
- return exports.syncMapFirst(plugins.hooks[hook_name], function (hook) {
+ if (exports.plugins.hooks[hook_name] === undefined) return [];
+ return exports.syncMapFirst(exports.plugins.hooks[hook_name], function (hook) {
return hookCallWrapper(hook, hook_name, args);
});
}
@@ -103,9 +102,9 @@ exports.callFirst = function (hook_name, args) {
exports.aCallFirst = function (hook_name, args, cb) {
if (!args) args = {};
if (!cb) cb = function () {};
- if (plugins.hooks[hook_name] === undefined) return cb(null, []);
+ if (exports.plugins.hooks[hook_name] === undefined) return cb(null, []);
exports.mapFirst(
- plugins.hooks[hook_name],
+ exports.plugins.hooks[hook_name],
function (hook, cb) {
hookCallWrapper(hook, hook_name, args, function (res) { cb(null, res); });
},