Created
August 16, 2013 12:39
-
-
Save ajcrites/6249540 to your computer and use it in GitHub Desktop.
Example of synchronous vs. asynchronous JS
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
// Old, bad, antiquated way | |
var value = db.synchronousRead("SELECT value"); | |
emit(value); | |
// Good, asynchronous way | |
db.asynchronousRead("SELECT value").done(function (value) { | |
emit(value); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment