Created
September 29, 2017 00:09
-
-
Save mgruesbeck/eed870cfb51a5e19248e52c299c15186 to your computer and use it in GitHub Desktop.
Refreshing memory on node callbacks and exports
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 http = require('http'); | |
var numbers = { | |
one: 'one', | |
two: 'two', | |
three: 'three' | |
}; | |
function start(callback2, callback3){ | |
console.log('starting countdown'); | |
console.log(numbers.one); | |
callback2(callback3); | |
}; | |
function two(callback3){ | |
console.log(numbers.two); | |
console.log(http.get('http://www.google.com')); | |
callback3(); | |
}; | |
function three(){ | |
console.log(numbers.three); | |
console.log('countdown complete'); | |
}; | |
module.exports = { | |
start: start, | |
two: two, | |
three: three | |
}; | |
//{import_var_name}.start({import_var_name}.two, {import_var_name}.three); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment