Last active
August 29, 2015 13:55
-
-
Save marcusoftnet/8765046 to your computer and use it in GitHub Desktop.
Example callback function
This file contains 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
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