Last active
October 16, 2015 11:27
-
-
Save artemjackson/1256af2fcdfddd8486ee to your computer and use it in GitHub Desktop.
Promise exampel for dear Ksenia
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
import q from "Q"; | |
getNameAsync().then(greet); | |
function getNameAsync(){ | |
const deferred = q.defer(); | |
deferred.resolve("Ksenia"); | |
return deferred.promise; | |
} | |
function greet(name) { | |
console.log("Hello, " + name + "!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment