Skip to content

Instantly share code, notes, and snippets.

@mnichols
Last active December 4, 2015 04:20
Show Gist options
  • Save mnichols/de9bd65dedc41a84a51d to your computer and use it in GitHub Desktop.
Save mnichols/de9bd65dedc41a84a51d to your computer and use it in GitHub Desktop.
{
inflight: undefined
, fetch: function() {
if(this.inflight && this.inflight.then) {
return this.inflight.then(fetch.bind(this))
}
return this.inflight = Promise.resolve().then(function() {
//cant remember what jquery xhr api is ...i think 'done' is the thing here.
return this.save().done(function(res){
this.inflight = undefined
return res
})
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment