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

[Feature Request]Add a function to set global options #793

Open
NotEvenANeko opened this issue Apr 17, 2023 · 1 comment
Open

[Feature Request]Add a function to set global options #793

NotEvenANeko opened this issue Apr 17, 2023 · 1 comment

Comments

@NotEvenANeko
Copy link

Sometimes I want to set a proxy or TTL when sending a notification, but it's inconvient to call webpush.sendNotification with option parameter every time. What about adding a function like webpush.setConfig ?

btw, export the WebPushLib itself to allow users to initialize multiple instances might be useful for some users.

@marco-c
Copy link
Member

marco-c commented Apr 17, 2023

I don't see a big difference in practice between:

options = {
  ...
}

for (...) {
  webPush.sendNotification(subscription, payload, options);
}

and:

webPush.setConfig({
  ...
});

for (...) {
  webPush.sendNotification(subscription, payload);
}

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

2 participants