eventsource-close.js (268B)
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 this.close() 7 port.postMessage([true, this.readyState]) 8 } 9 } catch(e) { 10 port.postMessage([false, String(e)]) 11 } 12 }