Skip to content

Instantly share code, notes, and snippets.

@jamespeerless
Created February 7, 2015 01:45
Show Gist options
  • Save jamespeerless/b26b98ceb77b1b7d95e6 to your computer and use it in GitHub Desktop.
Save jamespeerless/b26b98ceb77b1b7d95e6 to your computer and use it in GitHub Desktop.
pollUntil: (pollingModel, checkModel, attr, delay) ->
@listenTo pollingModel, "sync", =>
if !checkModel.get(attr)
setTimeout =>
pollingModel.fetch()
, delay
else
pollingModel.trigger "finished:polling"
pollingModel.fetch()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment