Skip to content

Commit ba00b71

Browse files
committed
fix(src): add transition to button
1 parent 5b92996 commit ba00b71

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

mock/sw.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
importScripts("../dist/service-worker-updatefound-refresh-dialog.umd.js");
2-
self.addEventListener("install", function(event) {
3-
event.waitUntil(self.skipWaiting());
4-
});
5-
self.addEventListener("activate", function(event) {
6-
event.waitUntil(self.clients.claim());
7-
});

src/service-worker-updatefound-refresh-dialog.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
const isServiceWorker = 'ServiceWorkerGlobalScope' in self
55
&& self instanceof ServiceWorkerGlobalScope;
66
// *1 in sw.js
7+
// receive "skipWaiting" message and invoke `skipWaiting()`
78
if (isServiceWorker) {
89
self.addEventListener("message", event => {
910
if (!event.data) {
@@ -42,11 +43,13 @@ function showRefreshUI(registration, { message, onClick }) {
4243
right: var(--sw-updatefound-refresh-dialog--right, 5%);
4344
top: var(--sw-updatefound-refresh-dialog--top, initial);
4445
bottom: var(--sw-updatefound-refresh-dialog--bottom, 30px);
46+
transition: var(--sw-updatefound-refresh-dialog--transition, opacity 0.5s ease-out);
4547
`;
4648
dialog.textContent = message;
4749

4850
var listener = function() {
4951
dialog.disabled = true;
52+
dialog.style.opacity = 0;
5053
dialog.removeEventListener("click", listener);
5154
onClick(registration);
5255
};

0 commit comments

Comments
 (0)