web-push-libs / web-push

Web Push library for Node.js
Other
3.21k stars 306 forks source link

Add support for multiple WebPush instances #876

Open WeeJeWel opened 6 months ago

WeeJeWel commented 6 months ago

This is a feature requests for a class-based update of this amazing library.

For example:

import { WebPush } from 'web-push';

const webPush = new WebPush();
webpush.setVapidDetails(...);
webpush.sendNotification(...);

This will allow for using multiple credentials in a single Node.js server. It also feels like cleaner code in my opinion.

lokshunhung commented 4 months ago

@WeeJeWel I made some minimal changes to allow that in #889

WeeJeWel commented 4 months ago

Very nice! 🙌🏻