Skip to content

Instantly share code, notes, and snippets.

@marcusoftnet
Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusoftnet/8765046 to your computer and use it in GitHub Desktop.
Save marcusoftnet/8765046 to your computer and use it in GitHub Desktop.
Example callback function
function doSomething(p, callback){
// does something using the p parameter
// maybe call some other service
// that takes a long time to complete
// when that is finally completed.
// it calls back
// by just calling the callback function
callback();
}
// The above is invoked like this, for example
module.doSomething(123, function () {
console.log("it's done!");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment