Skip to content

Instantly share code, notes, and snippets.

@Termina1
Last active August 29, 2015 14:17
Show Gist options
  • Save Termina1/0e2527b3b730afd1e41b to your computer and use it in GitHub Desktop.
Save Termina1/0e2527b3b730afd1e41b to your computer and use it in GitHub Desktop.
function getValue(id, cache, retrieveValue) {
if(cache.has(id)) {
return cache.get(id);
} else {
return new Promise(function(ful, rej) {
retrieveValue(id, ful, rej);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment