eventsource-onopen.js (308B)
1 onconnect = function(e) { 2 try { 3 var port = e.ports[0] 4 var source = new EventSource("../resources/message.py") 5 source.onopen = function(e) { 6 port.postMessage([true, source.readyState, 'data' in e, e.bubbles, e.cancelable]) 7 this.close() 8 } 9 } catch(e) { 10 port.postMessage([false, String(e)]) 11 } 12 }