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