Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better types in onLoad and hide-notification-permission-dialog #36

Open
finnan444 opened this issue Nov 12, 2024 · 0 comments
Open

Better types in onLoad and hide-notification-permission-dialog #36

finnan444 opened this issue Nov 12, 2024 · 0 comments

Comments

@finnan444
Copy link

Hello, which is the best way to subscribe to hide-notification-permission-dialog event?
I am using npm package and this kinda works, but typescript raises errors that Type '"onLoad"' is not assignable to type 'EventName'.ts(2322) and Property 'addEventHandler' does not exist on type 'Pushwoosh'.ts(2339)

import { Pushwoosh } from 'web-push-notifications'

const pwInstance = new Pushwoosh()

pwInstance.push([
   'onLoad',
   function (_api) {
       pwInstance.addEventHandler('hide-notification-permission-dialog', function (payload) {
           if (payload.permission === 'denied') {
               //...
           }

           if (payload.permission === 'default') {
               //...
           }
       })
   },
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant