var Async = require('async');
var Test_Hander = function () {
};
Test_Hander.prototype.begin = function () {
Async.series([
this.first, // this.first.bind(this) does not work either
this.second
],function (error) {
if (error) {
// shit
}
else {
// good
}
});
};
Test_Hander.prototype.first = function (callback) {
console.log('Enter first function');
callback(null,'I am from first function');
};
Test_Hander.prototype.second = function (one, callback) {
console.log('Enter second function');
console.log('parameter one: ');
console.log(one);
console.log(callback);
callback(null);
};
var hander = new Test_Hander();
hander.begin();
I want to pass some value from function first to function second. And I know that waterfall and global variable are both ok. However, can I just pass a result value from function first to function second without using waterfall and global variable?