Type Alias: UsePushNotificationsOptions
UsePushNotificationsOptions =
object
Defined in: usePushNotifications.ts:15
Properties
enabled?
optionalenabled?:boolean
Defined in: usePushNotifications.ts:37
Set to false where no service worker is registered (local dev), and
the hook reports unsupported. Defaults to true.
onError?
optionalonError?: (error) =>void
Defined in: usePushNotifications.ts:32
Called with every unexpected error, for error tracking.
Parameters
| Parameter | Type |
|---|---|
error | Error |
Returns
void
onSubscribe
onSubscribe: (
subscription) =>Promise<void>
Defined in: usePushNotifications.ts:24
Persists a new subscription. A rejection unsubscribes the browser again, so the browser and the server never disagree.
Parameters
| Parameter | Type |
|---|---|
subscription | PushSubscriptionData |
Returns
Promise<void>
onUnsubscribe
onUnsubscribe: (
subscription) =>Promise<void>
Defined in: usePushNotifications.ts:28
Removes a subscription before the browser drops it.
Parameters
| Parameter | Type |
|---|---|
subscription | { endpoint: string; } |
subscription.endpoint | string |
Returns
Promise<void>
vapidPublicKey
vapidPublicKey:
string|undefined
Defined in: usePushNotifications.ts:19
The server's VAPID public key, base64url encoded.