Skip to content

Instantly share code, notes, and snippets.

@owainlewis
Created February 20, 2014 19:07
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 owainlewis/9120910 to your computer and use it in GitHub Desktop.
Save owainlewis/9120910 to your computer and use it in GitHub Desktop.
App.prototype = {
poll: function(endpoint){
$.ajax({ url: endpoint, success: function(data){
console.log(data);
}, dataType: "json", complete: _.bind(function() {
setTimeout(_.bind(function() {
this.poll(endpoint)
}, this), this.pollingFrequency);
}, this), timeout: 3000 });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment