web-push
web-push copied to clipboard
[Feature Request]Add a function to set global options
trafficstars
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.
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);
}