feat(useWebNotification): add requestPermissions
option, return permissionGranted
and ensurePermissions
#3325
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This MR addresses the usage concerns in #3314
This MR does not introduce breaking changes to the usage of the functional API, but introduces a change in the triggering of the notification request permission, i.e., it will no longer request permission
onMounted
.🤖 Generated by Copilot at 093dd7a
This pull request enhances the
useWebNotification
hook with a new option and helper functions to request permission for web notifications more flexibly and conveniently. It also updates the documentation with an example of using the new option.🤖 Generated by Copilot at 093dd7a
requestOnMounted
option touseWebNotification
hook to control when permission is requested (link,link,link,link)hasPermission
andrequestPermission
functions (link,link,link)defaultOptions
todefaultWebNotificationOptions
and destructurewindow
option (link,link)useWebNotification/index.md
with new option and functions (link)