blob: a68dc5b0b7dac67037315d293ae879cc70fc2a4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
onconnect = function(e) {
try {
var port = e.ports[0]
var url = decodeURIComponent(location.hash.substr(1))
var source = new EventSource(url)
source.onerror = function(e) {
port.postMessage([true, this.readyState, 'data' in e])
this.close();
}
} catch(e) {
port.postMessage([false, String(e)])
}
}
|