service worker fetch event for Add To Home Screen
This commit is contained in:
@@ -67,3 +67,19 @@ self.addEventListener('notificationclick', function(event) {
|
|||||||
|
|
||||||
event.waitUntil(promises);
|
event.waitUntil(promises);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// This is needed for 'Add to Home Screen'.
|
||||||
|
self.addEventListener('fetch', function (event) {
|
||||||
|
event.respondWith(
|
||||||
|
// Try to find response in cache.
|
||||||
|
caches.match(event.request)
|
||||||
|
.then((resp) => {
|
||||||
|
// If response is found in cache, return it. Otherwise fetch.
|
||||||
|
return resp || fetch(event.request);
|
||||||
|
})
|
||||||
|
.catch((err) {
|
||||||
|
// Something went wrong.
|
||||||
|
console.error("Service worker Fetch: ", err);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|||||||
@@ -829,7 +829,8 @@ class TinodeWeb extends React.Component {
|
|||||||
params.public = pub;
|
params.public = pub;
|
||||||
}
|
}
|
||||||
if (priv) {
|
if (priv) {
|
||||||
params.private = {comment: priv};
|
params.private = (priv === Tinode.DEL_CHAR) ?
|
||||||
|
Tinode.DEL_CHAR : {comment: priv};
|
||||||
}
|
}
|
||||||
if (permissions) {
|
if (permissions) {
|
||||||
params.defacs = permissions;
|
params.defacs = permissions;
|
||||||
|
|||||||
Reference in New Issue
Block a user