blob: 7f3e915978d72c62b302a8af6e34ae774613cb4a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<!DOCTYPE HTML>
<html>
<body>
<script type="application/javascript">
function info(msg) {
parent.postMessage({type: "info", msg }, "*");
}
let registration;
info("Registering a ServiceWorker");
navigator.serviceWorker.register('sw_1502055.js', {scope: "foo/"})
.then(reg => {
registration = reg;
info("Fetching a resource");
return fetch("file_1502055.sjs")
}).then(r => r.text())
.then(() => {
info("Fetching a resource, again");
return fetch("file_1502055.sjs")
}).then(r => r.text()).then(() => {
info("Unregistering the ServiceWorker");
return registration.unregister();
})
.then(() => {
parent.postMessage({ type: "finish" }, "*");
});
</script>
</body>
</html>
|