web-push icon indicating copy to clipboard operation
web-push copied to clipboard

[Feature Request]Add a function to set global options

Open NotEvenANeko opened this issue 2 years ago • 1 comments
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.

NotEvenANeko avatar Apr 17 '23 03:04 NotEvenANeko

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);
}

marco-c avatar Apr 17 '23 08:04 marco-c