Skip to content

Instantly share code, notes, and snippets.

@adomado
Created April 27, 2011 08:20
Show Gist options
  • Select an option

  • Save adomado/943909 to your computer and use it in GitHub Desktop.

Select an option

Save adomado/943909 to your computer and use it in GitHub Desktop.

Revisions

  1. adomado created this gist Apr 27, 2011.
    25 changes: 25 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    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...
    }

    });