Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
Tim Visée
barbapappa
Commits
3efa8403
Verified
Commit
3efa8403
authored
Aug 25, 2020
by
Tim Visée
☕
Browse files
Fix generated service worker, temporarily exclude caches causing errors
parent
beb8405a
Pipeline
#181868741
passed with stage
in 4 minutes and 52 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
31 deletions
+8
-31
webapp/resources/js/app.js
webapp/resources/js/app.js
+1
-1
webapp/resources/js/sw.js
webapp/resources/js/sw.js
+0
-29
webapp/webpack.mix.js
webapp/webpack.mix.js
+7
-1
No files found.
webapp/resources/js/app.js
View file @
3efa8403
...
...
@@ -8,7 +8,7 @@ var pwaDeferredPrompt = null;
// Register service worker for PWA/offline usage
if
(
'
serviceWorker
'
in
navigator
)
{
window
.
addEventListener
(
'
load
'
,
()
=>
{
navigator
.
serviceWorker
.
register
(
'
/
service-worker
.js
'
).
then
(
registration
=>
{
navigator
.
serviceWorker
.
register
(
'
/
js/sw
.js
'
).
then
(
registration
=>
{
console
.
log
(
'
Service worker registered:
'
,
registration
);
}).
catch
(
registrationError
=>
{
console
.
log
(
'
Service worker registration failed:
'
,
registrationError
);
...
...
webapp/resources/js/sw.js
deleted
100644 → 0
View file @
beb8405a
self
.
addEventListener
(
'
install
'
,
function
(
e
)
{
e
.
waitUntil
(
caches
.
open
(
'
barbapappa
'
).
then
(
function
(
cache
)
{
return
cache
.
addAll
([
// TODO: improve this list, less resources, only necessary
'
/css/app.css
'
,
'
/css/flag-icon.css
'
,
'
/css/glyphicons-packed.css
'
,
'
/css/semnatic.min.css
'
,
'
/img/logo/logo_square.png
'
,
'
/js/app.js
'
,
'
/js/jquery-packed.js
'
,
'
/js/lang.js
'
,
'
/js/quickbuy.js
'
,
'
/js/semantic.min.js
'
,
]);
})
);
});
self
.
addEventListener
(
'
fetch
'
,
function
(
e
)
{
// TODO: remove console log here, only to debug?
console
.
log
(
e
.
request
.
url
);
e
.
respondWith
(
caches
.
match
(
e
.
request
).
then
(
function
(
response
)
{
return
response
||
fetch
(
e
.
request
);
})
);
});
webapp/webpack.mix.js
View file @
3efa8403
...
...
@@ -10,7 +10,13 @@ mix.webpackConfig({
onBuildStart
:[
'
php artisan lang:js --compress --quiet
'
],
onBuildEnd
:[],
}),
new
GenerateSW
(),
new
GenerateSW
({
// TODO: do not exclude common files
exclude
:
[
/.*
\.(
js|css
)
/
],
swDest
:
'
js/sw.js
'
,
}),
]
});
...
...
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