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

Support multiple instances #889

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lokshunhung
Copy link

Goal

Resolves #876

Implementation

  • Instead of having a module-scoped gcmAPIKey and vapidDetails in src/web-push-lib.js, we change those to instance properties of a WebPushLib class instance.
  • When re-exporting the setGCMAPIKey, setVapidDetails, generateRequestDetails for the global instance of WebPushLib, we need to .bind() the methods to retain the this context.
  • Also export the WebPushLib constructor so users can create multiple instances instead of just using the global instance.

@marco-c
Copy link
Member

marco-c commented Feb 20, 2024

@lokshunhung could you add a test for this?

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

Successfully merging this pull request may close these issues.

Add support for multiple WebPush instances
2 participants