mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
Bugfix: Async bump part 2
Sorry, not sure what happened but having kids jump all over the keyboard while I do this probably didn't help... :|
This commit is contained in:
parent
b3680058ff
commit
d1330a1e1c
2 changed files with 14 additions and 12 deletions
|
@ -30,7 +30,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "3.2.0",
|
"async": "^3.2.0",
|
||||||
"async-stacktrace": "0.0.2",
|
"async-stacktrace": "0.0.2",
|
||||||
"channels": "0.0.4",
|
"channels": "0.0.4",
|
||||||
"cheerio": "0.22.0",
|
"cheerio": "0.22.0",
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
var async = require("async");
|
|
||||||
var _ = require("underscore");
|
var _ = require("underscore");
|
||||||
|
|
||||||
exports.bubbleExceptions = true
|
exports.bubbleExceptions = true
|
||||||
|
@ -78,19 +77,22 @@ exports.callAll = function (hook_name, args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function aCallAll(hook_name, args, cb) {
|
async function aCallAll(hook_name, args, cb) {
|
||||||
if (!args) args = {};
|
if (!args) args = {};
|
||||||
if (!cb) cb = function () {};
|
if (!cb) cb = function () {};
|
||||||
if (exports.plugins.hooks[hook_name] === undefined) return cb(null, []);
|
if (exports.plugins.hooks[hook_name] === undefined) return cb(null, []);
|
||||||
async.map(
|
|
||||||
exports.plugins.hooks[hook_name],
|
var newArray = [];
|
||||||
function (hook, cb) {
|
// This should be a map.
|
||||||
hookCallWrapper(hook, hook_name, args, function (res) { cb(null, res); });
|
await exports.plugins.hooks[hook_name].forEach(async function(hook, index){
|
||||||
},
|
let test = await hookCallWrapper(hook, hook_name, args, function (res) {
|
||||||
function (err, res) {
|
return Promise.resolve(res);
|
||||||
cb(null, _.flatten(res, true));
|
});
|
||||||
}
|
newArray.push(test)
|
||||||
);
|
});
|
||||||
|
|
||||||
|
// after forEach
|
||||||
|
cb(null, _.flatten(newArray, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return a Promise if cb is not supplied */
|
/* return a Promise if cb is not supplied */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue