code: function(url) {                                                                         // 2278
      var that = this;                                                                                              // 2279
      var es = new EventSource(url);                                                                                // 2280
      es.onmessage = function(e) {                                                                                  // 2281
          that.dispatchEvent(new SimpleEvent('message',                                                             // 2282
                                             {'data': unescape(e.data)}));                                          // 2283
      };                                                                                                            // 2284
      that.es_close = es.onerror = function(e, abort_reason) {                                                      // 2285
          // ES on reconnection has readyState = 0 or 1.                                                            // 2286
          // on network error it's CLOSED = 2                                                                       // 2287
          var reason = abort_reason ? 'user' :                                                                      // 2288
              (es.readyState !== 2 ? 'network' : 'permanent');                                                      // 2289
          that.es_close = es.onmessage = es.onerror = null;                                                         // 2290
          // EventSource reconnects automatically.                                                                  // 2291
          es.close();                                                                                               // 2292
          es = null;                                                                                                // 2293
          // Safari and chrome < 15 crash if we close window before                                                 // 2294
          // waiting for ES cleanup. See:                                                                           // 2295
          //   https://code.google.com/p/chromium/issues/detail?id=89155                                            // 2296
          utils.delay(200, function() {                                                                             // 2297
                          that.dispatchEvent(new SimpleEvent('close', {reason: reason}));                           // 2298
                      });                                                                                           // 2299
      };                                                                                                            // 2300
  }
docs: 2265 [*] End of lib/trans-polling.js                                                                        // 2266 2267 2268 [*] Including lib/trans-receiver-eventsource.js                                                        // 2269 /*                                                                                                                // 2270
  ***** BEGIN LICENSE BLOCK *****                                                                                // 2271
  Copyright (c) 2011-2012 VMware, Inc.                                                                           // 2272
  // 2273
  For the license see COPYING.                                                                                   // 2274
  ***** END LICENSE BLOCK *****                                                                                  // 2275
   2276 2277