Last active
December 4, 2015 04:20
-
-
Save mnichols/de9bd65dedc41a84a51d 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
{ | |
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