OLD | NEW |
---|---|
(Empty) | |
1 self.onmessage = e => { | |
2 if ('port' in e.data) { | |
3 let port = e.data.port; | |
4 port.onmessage = (e) => { | |
5 fetch(e.data) | |
6 .then(response => response.text()) | |
7 .then(text => port.postMessage('Worker reply:' + text)); | |
8 }; | |
9 port.postMessage('Connected'); | |
10 } | |
11 }; | |
OLD | NEW |