Skip to content

Check for addEventListener() before calling #2994

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

Merged
merged 1 commit into from
Apr 27, 2020
Merged

Conversation

schmidt-sebastian
Copy link
Contributor

Fixes #2991

@google-oss-bot
Copy link
Contributor

Binary Size Report

Affected SDKs

  • @firebase/firestore

    Type Base (8c36958) Head (0db4417) Diff
    browser 247 kB 247 kB +39 B (+0.0%)
    esm2017 193 kB 193 kB +39 B (+0.0%)
    main 487 kB 487 kB +45 B (+0.0%)
    module 245 kB 245 kB +39 B (+0.0%)
  • @firebase/firestore/memory

    Type Base (8c36958) Head (0db4417) Diff
    browser 188 kB 188 kB +39 B (+0.0%)
    esm2017 148 kB 148 kB +39 B (+0.0%)
    main 364 kB 364 kB +45 B (+0.0%)
    module 186 kB 186 kB +39 B (+0.0%)
  • firebase

    Type Base (8c36958) Head (0db4417) Diff
    firebase-firestore.js 289 kB 289 kB +39 B (+0.0%)
    firebase-firestore.memory.js 231 kB 231 kB +39 B (+0.0%)
    firebase.js 822 kB 822 kB +39 B (+0.0%)

Test Logs

@@ -240,7 +240,7 @@ export class AsyncQueue {

constructor() {
const window = PlatformSupport.getPlatform().window;
if (window) {
if (window && typeof window.addEventListener === 'function') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why checking for the type particularly? Are there platforms where this exists but not a function? Just curious, LGTM anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to find out....

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is needed for React Native dev.

@schmidt-sebastian schmidt-sebastian merged commit ccb9bf9 into master Apr 27, 2020
@firebase firebase locked and limited conversation to collaborators May 28, 2020
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/v4 branch July 9, 2020 17:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: e.addEventListener is not a function - Firestore (Expo)
5 participants