FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
upytest/mini-coi.js at main · pyscript/upytest · GitHub
pyscript
/
upytest
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
9
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
upytest
/
mini-coi.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (28 loc) · 1.19 KB
Breadcrumbs
upytest
/
mini-coi.js
Copy path
File metadata and controls
28 lines (28 loc) · 1.19 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
/*! coi-serviceworker v0.1.7 - Guido Zuidhof and contributors, licensed under MIT */
/*! mini-coi - Andrea Giammarchi and contributors, licensed under MIT */
(
(
{
document
:
d
,
navigator
:
{
serviceWorker
:
s
}
}
)
=>
{
if
(
d
)
{
const
{
currentScript
:
c
}
=
d
;
s
.
register
(
c
.
src
,
{
scope
:
c
.
getAttribute
(
'scope'
)
||
'.'
}
)
.
then
(
r
=>
{
r
.
addEventListener
(
'updatefound'
,
(
)
=>
location
.
reload
(
)
)
;
if
(
r
.
active
&&
!
s
.
controller
)
location
.
reload
(
)
;
}
)
;
}
else
{
addEventListener
(
'install'
,
(
)
=>
skipWaiting
(
)
)
;
addEventListener
(
'activate'
,
e
=>
e
.
waitUntil
(
clients
.
claim
(
)
)
)
;
addEventListener
(
'fetch'
,
e
=>
{
const
{
request
:
r
}
=
e
;
if
(
r
.
cache
===
'only-if-cached'
&&
r
.
mode
!==
'same-origin'
)
return
;
e
.
respondWith
(
fetch
(
r
)
.
then
(
r
=>
{
const
{
body
,
status
,
statusText
}
=
r
;
if
(
!
status
||
status
>
399
)
return
r
;
const
h
=
new
Headers
(
r
.
headers
)
;
h
.
set
(
'Cross-Origin-Opener-Policy'
,
'same-origin'
)
;
h
.
set
(
'Cross-Origin-Embedder-Policy'
,
'require-corp'
)
;
h
.
set
(
'Cross-Origin-Resource-Policy'
,
'cross-origin'
)
;
return
new
Response
(
body
,
{
status
,
statusText
,
headers
:
h
}
)
;
}
)
)
;
}
)
;
}
}
)
(
self
)
;
Back
|
FazBrowse Home
|
New Git URL