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

Add support for addEventListener(...) and other EventTarget methods #139

Open
ithinkihaveacat opened this issue Aug 17, 2017 · 0 comments
Open

Comments

@ithinkihaveacat
Copy link

Describe your environment

  • Operating System version: NA
  • Firebase SDK version: 4.2
  • Firebase Product: messaging

Describe the problem

Actual:

There's no addEventListener() method on the firebase.messaging() object.

Expected:

The following code outputs "MESSAGE 1" and "MESSAGE 2" when a message is received:

firebase.messaging().addEventListener("message", () => console.log("MESSAGE 1"));
firebase.messaging().addEventListener("message", () => console.log("MESSAGE 2"));

Discussion:

The method names onMessage() and onTokenRefresh() suggest that firebase.messaging.Messaging implements the EventTarget interface. However, this is not the case, which impairs the DX, as well as making it impossible to easily add multiple listeners for the same event, remove listeners, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants