Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
P
PWATraining
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
training
PWATraining
Commits
02c9e770
Commit
02c9e770
authored
Jul 27, 2020
by
mohd rafhan bin mohd amin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding service worker
parent
cbe8b09c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
app.js
src/js/app.js
+6
-0
sw.js
src/js/sw.js
+12
-1
No files found.
src/js/app.js
View file @
02c9e770
...
@@ -221,6 +221,12 @@
...
@@ -221,6 +221,12 @@
async
function
run
()
{
async
function
run
()
{
app
.
registration
=
await
navigator
.
serviceWorker
.
register
(
'/sw.js'
,
{
scope
:
'/'
})
.
then
(
async
function
(
sw
)
{
console
.
info
(
'ServiceWorker registered: '
,
sw
.
scope
);
return
sw
;
});
};
};
app
.
nextTick
=
function
()
{
app
.
nextTick
=
function
()
{
...
...
src/js/sw.js
View file @
02c9e770
importScripts
(
'https://storage.googleapis.com/workbox-cdn/releases/5.1.3/workbox-sw.js'
);
\ No newline at end of file
if
(
workbox
)
{
console
.
log
(
`Yay! Workbox is loaded 🎉`
);
workbox
.
precaching
.
precacheAndRoute
(
self
.
__WB_MANIFEST
);
workbox
.
googleAnalytics
.
initialize
();
}
else
{
console
.
log
(
`Boo! Workbox didn't load 😬`
);
}
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