Skip to content

Commit

Permalink
Merge pull request #198 from remix-pwa/feat/push
Browse files Browse the repository at this point in the history
fix(push): new doc comments for `usePush` functions
  • Loading branch information
ShafSpecs authored Apr 24, 2024
2 parents e88ab0c + 128f7d2 commit 4e9a2a4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/push/client/hook/usePush.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,27 @@ export type PushObject = {
* The push subscription object
*/
pushSubscription: PushSubscription | null;
/**
* Request permission for push notifications
* @returns The permission status of the push notifications
*/
requestPermission: () => NotificationPermission;
/**
* Utility to subscribe to push notifications
* @param publicKey the public vapid key
* @param callback a callback function to be called when the subscription is successful
* @param errorCallback a callback function to be called if the subscription fails
*/
subscribeToPush: (
publicKey: string,
callback?: (subscription: PushSubscription) => void,
errorCallback?: (error: any) => void
) => void;
/**
* Utility to unsubscribe from push notifications
* @param callback a callback function to be called when the unsubscription is successful
* @param errorCallback a callback function to be called if the unsubscription fails
*/
unsubscribeFromPush: (callback?: () => void, errorCallback?: (error: any) => void) => void;
/**
* Boolean state indicating whether the user has allowed sending of push notifications or not.
Expand Down

0 comments on commit 4e9a2a4

Please sign in to comment.