Skip to content

Instantly share code, notes, and snippets.

@nfons nfons/optimize.js

Last active Apr 12, 2018
Embed
What would you like to do?
var syncDep;
function getLottery() {
return new Promise((resolve, reject) =>{
if (syncDep === undefined) { //check of we already have this data...if not THEN go get
setTimeout(function() {
syncDep = [1,22,34,56,5];
resolve(syncDep);
}, 2000);
} else {
console.log('syncSet');
resolve(syncDep);
}
});
}
exports.handler = function(context, event, callback) {
getLottery().then(numbers =>{
callback(null,numbers);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.