Skip to content

Instantly share code, notes, and snippets.

@adomado
Created April 27, 2011 08:20
Show Gist options
  • Save adomado/943909 to your computer and use it in GitHub Desktop.
Save adomado/943909 to your computer and use it in GitHub Desktop.
FBNotificationWatcher_without_jQuery.proxy
var FBNotificationWatcher = new JS.Class({
initialize : function(timeout) {
this.url = "http://foo/return/json";
this.getNotifications(); // initiate the first fetch
},
getNotifications : function() {
var url = this.url;
$.ajax({
// do your ajax call
success : this.processNotifications
});
},
processNotifications : function(rawNotificationData) {
// process notifications...
setTimeout(this.getNotifications, this.timeout); // start all over again...
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment