~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/app/longpoll/javascript/longpoll.js

  • Committer: Stuart Bishop
  • Date: 2011-09-28 12:49:24 UTC
  • mfrom: (9893.10.1 trivial)
  • mto: This revision was merged to the branch mainline in revision 14178.
  • Revision ID: stuart.bishop@canonical.com-20110928124924-m5a22fymqghw6c5i
Merged trivial into distinct-db-users.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright 2009 Canonical Ltd.  This software is licensed under the
 
1
/* Copyright 2011 Canonical Ltd.  This software is licensed under the
2
2
 * GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 *
4
4
 * The Launchpad Longpoll module provides the functionnality to deal
9
9
 * is populated.
10
10
 *
11
11
 * Usually the only thing you will want to do to use the long polling feature
12
 
 * is to make sure LP.cache.longpoll is populated and then create Javascript
13
 
 * handlers for the events which will be fired.
14
 
 * You also might create handlers for the generic long polling events
15
 
 * (see below).
 
12
 * is:
 
13
 *
 
14
 * a) to make sure LP.cache.longpoll is populated with 'key' and 'uri'.
 
15
 *
 
16
 * b) to create Javascript handlers for the events which will be fired:
 
17
 *    - event_key will be fired when the event on the server side is triggered
 
18
 *    (event_key being the name of the event on the server side).
 
19
 *    - see below for other events fired by the longpoll machinery.
 
20
 *
16
21
 * @module longpoll
17
22
 */
18
23
YUI.add('lp.app.longpoll', function(Y) {
79
84
    successPoll : function (id, response) {
80
85
        try {
81
86
            var data = Y.JSON.parse(response.responseText);
82
 
            var event_key = data.event_key;
83
 
            var event_data = data.event_data;
84
 
            Y.fire(event_key, event_data);
 
87
            Y.fire(data.event_key, data);
85
88
            return true;
86
89
        }
87
90
        catch (e) {