-
-
Save yogasw/78401f8a1491dd42329f9c91bbf0af1b 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