feat: add support for the Web Share Target API (#1100)
Co-authored-by: userquin <userquin@gmail.com>
This commit is contained in:
parent
a6a825e553
commit
bede92404b
11 changed files with 221 additions and 7 deletions
|
@ -7,6 +7,7 @@ import { StaleWhileRevalidate } from 'workbox-strategies'
|
|||
import { ExpirationPlugin } from 'workbox-expiration'
|
||||
|
||||
import { onNotificationClick, onPush } from './web-push-notifications'
|
||||
import { onShareTarget } from './share-target'
|
||||
|
||||
declare const self: ServiceWorkerGlobalScope
|
||||
|
||||
|
@ -32,7 +33,7 @@ if (import.meta.env.DEV)
|
|||
// deny api and server page calls
|
||||
let denylist: undefined | RegExp[]
|
||||
if (import.meta.env.PROD)
|
||||
denylist = [/^\/api\//, /^\/login\//, /^\/oauth\//, /^\/signin\//]
|
||||
denylist = [/^\/api\//, /^\/login\//, /^\/oauth\//, /^\/signin\//, /^\/web-share-target\//]
|
||||
|
||||
// only cache pages and external assets on local build + start or in production
|
||||
if (import.meta.env.PROD) {
|
||||
|
@ -90,3 +91,4 @@ registerRoute(new NavigationRoute(
|
|||
|
||||
self.addEventListener('push', onPush)
|
||||
self.addEventListener('notificationclick', onNotificationClick)
|
||||
self.addEventListener('fetch', onShareTarget)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue