Created
June 13, 2013 17:07
-
-
Save manast/5775455 to your computer and use it in GitHub Desktop.
Continuable vs Promises
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
// ES6 syntax | |
var target = yield fs.readlink("/path/to/symlink"); | |
// ES5 syntax | |
fs.readlink("/path/to/symlink")(function (err, target) { | |
if (err) throw err; | |
// do something with target | |
}); | |
// Promised based | |
fs.readlink("/path/to/symlink").then(function (target) { | |
// do something with target | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment