Skip to content

Instantly share code, notes, and snippets.

@mgruesbeck
Created September 29, 2017 00:09
Show Gist options
  • Save mgruesbeck/eed870cfb51a5e19248e52c299c15186 to your computer and use it in GitHub Desktop.
Save mgruesbeck/eed870cfb51a5e19248e52c299c15186 to your computer and use it in GitHub Desktop.
Refreshing memory on node callbacks and exports
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