Skip to content

Instantly share code, notes, and snippets.

@jcoglan
Forked from gr2m/combine_requests.js
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcoglan/ff49998991022aad4e22 to your computer and use it in GitHub Desktop.
Save jcoglan/ff49998991022aad4e22 to your computer and use it in GitHub Desktop.
var requestPromise;
function getCurrentState() {
if (requestPromise) return requestPromise;
requestPromise = ajaxRequestReturningPromise('GET', '/state.json');
reqrequestPromise.then(function() { requestPromise = null });
return requestPromise;
}
promise1 = getCurrentState()
promise2 = getCurrentState()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment