Skip to content

Instantly share code, notes, and snippets.

@nfons
Last active March 6, 2021 03:01
Show Gist options
  • Save nfons/91bca1483d912d6f1a27ad0f37554d4c to your computer and use it in GitHub Desktop.
Save nfons/91bca1483d912d6f1a27ad0f37554d4c 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