|
|
@ -39,7 +39,7 @@ read('./pewpew.txt', function (err, data) {
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = function () {
|
|
|
|
module.exports = function (/* task */) {
|
|
|
|
var map = {};
|
|
|
|
var map = {};
|
|
|
|
return function (id, cb, impl) {
|
|
|
|
return function (id, cb, impl) {
|
|
|
|
if (typeof(cb) !== 'function' || typeof(impl) !== 'function') {
|
|
|
|
if (typeof(cb) !== 'function' || typeof(impl) !== 'function') {
|
|
|
@ -49,6 +49,9 @@ module.exports = function () {
|
|
|
|
map[id] = [cb];
|
|
|
|
map[id] = [cb];
|
|
|
|
impl(function () {
|
|
|
|
impl(function () {
|
|
|
|
var args = Array.prototype.slice.call(arguments);
|
|
|
|
var args = Array.prototype.slice.call(arguments);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (map[id] && map[id].length > 1) { console.log("BATCH-READ DID ITS JOB for [%s][%s]", task, id); }
|
|
|
|
|
|
|
|
|
|
|
|
map[id].forEach(function (h) {
|
|
|
|
map[id].forEach(function (h) {
|
|
|
|
h.apply(null, args);
|
|
|
|
h.apply(null, args);
|
|
|
|
});
|
|
|
|
});
|
|
|
|