Skip to content

Commit

Permalink
docs: unregister service worker
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Jun 28, 2024
1 parent 86e63e3 commit fc3366a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
Binary file added v2/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added v2/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions v2/manifest.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "Cropper.js",
"short_name": "Cropper.js",
"description": "JavaScript image cropper.",
"start_url": "/cropperjs/v2/index.html",
"display": "standalone",
"background_color": "#fff",
"theme_color": "#39f",
"icons": [
{
"src": "/cropperjs/v2/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/cropperjs/v2/android-chrome-512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
13 changes: 13 additions & 0 deletions v2/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if ('serviceWorker' in navigator) {
self.addEventListener('install', () => {
self.skipWaiting();
});
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys()
.then((keys) => Promise.all(keys.map((key) => caches.delete(key))))
.then(() => navigator.serviceWorker.getRegistrations())
.then((registrations) => Promise.all(registrations.map((registration) => registration.unregister())))
);
});
}

0 comments on commit fc3366a

Please sign in to comment.