Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
libai
/
footseen-large-website
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1dc4cf28
authored
Dec 06, 2022
by
libai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试
parent
0d35399a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
mTest/index.js
mTest/sw.js
mTest/index.js
View file @
1dc4cf28
...
...
@@ -4,7 +4,7 @@
if
(
'serviceWorker'
in
navigator
)
{
navigator
.
serviceWorker
.
register
(
'/mTest/sw.js?V=202212060
1
'
)
.
register
(
'/mTest/sw.js?V=202212060
2
'
)
.
then
(()
=>
{
console
.
log
(
'Service Worker Registered'
);
});
}
...
...
@@ -13,7 +13,7 @@ var pwaT=null
let
deferredPrompt
;
const
addBtn
=
document
.
querySelector
(
'.add-button'
);
addBtn
.
style
.
display
=
'none'
;
console
.
log
(
322232
)
window
.
addEventListener
(
'beforeinstallprompt'
,
(
e
)
=>
{
console
.
log
(
3232
)
var
ua
=
window
.
navigator
.
userAgent
.
toLowerCase
();
...
...
mTest/sw.js
View file @
1dc4cf28
self
.
addEventListener
(
'install'
,
(
e
)
=>
{
//
e.waitUntil(
//
caches.open('footseen').then((cache) => cache.addAll([
//
'/mTest/',
//
'/mTest/index.html',
//
'/mTest/index.js',
//
])),
//
);
e
.
waitUntil
(
caches
.
open
(
'footseen'
).
then
((
cache
)
=>
cache
.
addAll
([
//
'/mTest/',
//
'/mTest/index.html',
//
'/mTest/index.js',
])),
);
});
// self.addEventListener('fetch', (e) => {
// // console.log(e.request.url);
// e.respondWith(
// caches.match(e.request).then((response) => response || fetch(e.request)),
// );
// });
\ No newline at end of file
self
.
addEventListener
(
'fetch'
,
(
e
)
=>
{
// console.log(e.request.url);
e
.
respondWith
(
caches
.
match
(
e
.
request
).
then
((
response
)
=>
response
||
fetch
(
e
.
request
)),
);
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment