You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

19 lines
417 B

var domain = require('domain');
function CallbackFiller() {
this.queues = {};
}
CallbackFiller.prototype.fill = function(key, err, data) {
var self = this;
var waiting = self.queues[key];
delete self.queues[key];
waiting.forEach(function(task) {
var taskDomain = task.domain || domain.create();
taskDomain.bind(task.cb)(err, data);
});
};
module.exports = CallbackFiller;