aboutsummaryrefslogtreecommitdiff
path: root/modern/src/serviceWorker.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-07-10 15:24:10 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-07-10 15:24:10 -0700
commit0512964d71a25c172735f2149ef60c3a8b20f683 (patch)
treef47b42326a7e6a0eaa2715ca8066cb3ca7e7bb90 /modern/src/serviceWorker.js
parent627cf95d59f625dcb0544bfd4c067d99dee4bb93 (diff)
downloadetbsa-traccar-web-0512964d71a25c172735f2149ef60c3a8b20f683.tar.gz
etbsa-traccar-web-0512964d71a25c172735f2149ef60c3a8b20f683.tar.bz2
etbsa-traccar-web-0512964d71a25c172735f2149ef60c3a8b20f683.zip
Use modified airbnb eslint
Diffstat (limited to 'modern/src/serviceWorker.js')
-rw-r--r--modern/src/serviceWorker.js38
1 files changed, 19 insertions, 19 deletions
diff --git a/modern/src/serviceWorker.js b/modern/src/serviceWorker.js
index f59f199..a034430 100644
--- a/modern/src/serviceWorker.js
+++ b/modern/src/serviceWorker.js
@@ -11,13 +11,13 @@
// opt-in, read https://bit.ly/CRA-PWA
const isLocalhost = Boolean(
- window.location.hostname === 'localhost' ||
+ window.location.hostname === 'localhost'
// [::1] is the IPv6 localhost address.
- window.location.hostname === '[::1]' ||
+ || window.location.hostname === '[::1]'
// 127.0.0.0/8 are considered localhost for IPv4.
- window.location.hostname.match(
- /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
- )
+ || window.location.hostname.match(
+ /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,
+ ),
);
export function register(config) {
@@ -42,8 +42,8 @@ export function register(config) {
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log(
- 'This web app is being served cache-first by a service ' +
- 'worker. To learn more, visit https://bit.ly/CRA-PWA'
+ 'This web app is being served cache-first by a service '
+ + 'worker. To learn more, visit https://bit.ly/CRA-PWA',
);
});
} else {
@@ -57,7 +57,7 @@ export function register(config) {
function registerValidSW(swUrl, config) {
navigator.serviceWorker
.register(swUrl)
- .then(registration => {
+ .then((registration) => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
if (installingWorker == null) {
@@ -70,8 +70,8 @@ function registerValidSW(swUrl, config) {
// but the previous service worker will still serve the older
// content until all client tabs are closed.
console.log(
- 'New content is available and will be used when all ' +
- 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
+ 'New content is available and will be used when all '
+ + 'tabs for this page are closed. See https://bit.ly/CRA-PWA.',
);
// Execute callback
@@ -93,7 +93,7 @@ function registerValidSW(swUrl, config) {
};
};
})
- .catch(error => {
+ .catch((error) => {
console.error('Error during service worker registration:', error);
});
}
@@ -103,15 +103,15 @@ function checkValidServiceWorker(swUrl, config) {
fetch(swUrl, {
headers: { 'Service-Worker': 'script' },
})
- .then(response => {
+ .then((response) => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type');
if (
- response.status === 404 ||
- (contentType != null && contentType.indexOf('javascript') === -1)
+ response.status === 404
+ || (contentType != null && contentType.indexOf('javascript') === -1)
) {
// No service worker found. Probably a different app. Reload the page.
- navigator.serviceWorker.ready.then(registration => {
+ navigator.serviceWorker.ready.then((registration) => {
registration.unregister().then(() => {
window.location.reload();
});
@@ -123,7 +123,7 @@ function checkValidServiceWorker(swUrl, config) {
})
.catch(() => {
console.log(
- 'No internet connection found. App is running in offline mode.'
+ 'No internet connection found. App is running in offline mode.',
);
});
}
@@ -131,11 +131,11 @@ function checkValidServiceWorker(swUrl, config) {
export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready
- .then(registration => {
+ .then((registration) => {
registration.unregister();
})
- .catch(error => {
+ .catch((error) => {
console.error(error.message);
});
}
-} \ No newline at end of file
+}