Skip to content

Instantly share code, notes, and snippets.

@mike-hogan
Created October 26, 2015 15:34
Show Gist options
  • Save mike-hogan/e1c684a4d80728fa545a to your computer and use it in GitHub Desktop.
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
"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