Skip to content

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