Created
April 27, 2011 08:20
-
-
Save adomado/943909 to your computer and use it in GitHub Desktop.
FBNotificationWatcher_without_jQuery.proxy
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
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