-
-
Save kenperkins/2d93ff7b7cb2889faf97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'); | |
var data; | |
MakeUsesrHttpCall(function(err,res){ | |
data.users = res; | |
}); | |
MakeTestHttpCall(function(err,res){ | |
data.tests = res; | |
}); | |
exports.init = function(callback) { | |
// you could eager return if the data is present, | |
// or perhaps via a supplied optional first argument | |
if (data) { | |
callback(null, data); | |
return; | |
} | |
data = {}; | |
async.parallel([ MakeUsesrHttpCall, MakeTestsHttpCall ], function(err) { | |
callback(err, data); | |
}); | |
}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = requre('a.js'); | |
a.init(function(err, data) { | |
// do something with data here | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment