eventsource-constructor-non-same-origin.js (317B)
1 onconnect = function(e) { 2 try { 3 var port = e.ports[0] 4 var url = decodeURIComponent(location.hash.substr(1)) 5 var source = new EventSource(url) 6 source.onerror = function(e) { 7 port.postMessage([true, this.readyState, 'data' in e]) 8 this.close(); 9 } 10 } catch(e) { 11 port.postMessage([false, String(e)]) 12 } 13 }