Skip to content

Instantly share code, notes, and snippets.

@Valid
Created October 20, 2010 22:49
Show Gist options
  • Save Valid/637515 to your computer and use it in GitHub Desktop.
Save Valid/637515 to your computer and use it in GitHub Desktop.
sys = require('sys');
getData = function(field, callback) {
console.log('this would get the data from ' + field + ' then continue');
//db.getFromField(field, function(error, response) {
//if(!error) {
// data = response
// callback(data);
callback('some data');
//}
}
runner = function() {
// get data from field, 'username'
getData('username', function(data) {
console.log('now you have ' + data)
// Script wouldn't get in here if getData hadn't returned 'data'
})
}
runner()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment