Skip to content

Instantly share code, notes, and snippets.

@yogasw
Forked from nfons/optimize.js
Created March 6, 2021 03:01
Show Gist options
  • Save yogasw/78401f8a1491dd42329f9c91bbf0af1b to your computer and use it in GitHub Desktop.
Save yogasw/78401f8a1491dd42329f9c91bbf0af1b to your computer and use it in GitHub Desktop.
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