OLD | NEW |
1 <script> | 1 <script> |
| 2 'use strict'; |
2 var link = document.createElement('link'); | 3 var link = document.createElement('link'); |
3 link.setAttribute('rel', 'serviceworker'); | 4 link.setAttribute('rel', 'serviceworker'); |
4 link.setAttribute('href', 'empty-worker.js'); | 5 link.setAttribute('href', 'empty-worker.js'); |
| 6 function report(result) { |
| 7 top.postMessage({id: location.search, result: result}, '*'); |
| 8 }; |
5 link.onload = function() { | 9 link.onload = function() { |
6 top.postMessage('loaded', '*'); | 10 report('loaded'); |
7 } | 11 }; |
8 link.onerror = function(e) { | 12 link.onerror = function() { |
9 top.postMessage('error', '*'); | 13 report('error'); |
10 } | 14 }; |
11 document.getElementsByTagName('head')[0].appendChild(link); | 15 document.getElementsByTagName('head')[0].appendChild(link); |
12 </script> | 16 </script> |
OLD | NEW |