Created
June 8, 2012 17:14
-
-
Save randallb/2896943 to your computer and use it in GitHub Desktop.
Backbone fetch limiting.
This file contains hidden or 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
#define @fetch in your initializer. | |
fetch: (options) -> | |
options.success = => | |
@fetching[@url] = undefined | |
options.error = => | |
@fetching[@url] = undefined | |
if JSON.stringify(@fetching[@url]) == JSON.stringify(options) | |
console.log "old fetch in progress for #{@url}" | |
else | |
console.log "Going to fetch for #{@url}" | |
@fetching[@url] = options | |
super options |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment