Created
October 26, 2015 15:34
-
-
Save mike-hogan/e1c684a4d80728fa545a to your computer and use it in GitHub Desktop.
Get a promise work on Node 0.10.36 on AWS Lamdba
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
"use strict"; | |
var Promise = require("es6-promise").Promise; | |
exports.learn = function (event, context) { | |
var promise = function (number) { | |
return new Promise(function (resolve, reject) { | |
var f = function(){resolve(number)}; | |
setTimeout(f, 5000); | |
}); | |
}; | |
promise(11) | |
.then(function (number) { | |
console.log(number); | |
context.succeed("done"); | |
}) | |
.catch(function (error) { | |
context.fail(error); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment