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

Check if "google" is defined #269

Merged
merged 4 commits into from
Feb 6, 2019
Merged

Check if "google" is defined #269

merged 4 commits into from
Feb 6, 2019

Conversation

rexagod
Copy link
Member

@rexagod rexagod commented Feb 1, 2019

Fixes publiclab/plots2#4717

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with grunt jasmine
  • code is in uniquely-named feature branch and has no merge conflicts
  • PR is descriptively titled
  • PR body includes fixes #0000-style reference to original issue #
  • ask @publiclab/reviewers for help, in a comment below

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If tests do fail, click on the red X to learn why by reading the logs.

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software

We have a loose schedule of reviewing and pulling in changes every Tuesday and Friday, and publishing changes on Fridays.

Thanks!

@rexagod rexagod requested a review from jywarren February 1, 2019 01:39
_module.blurredLocation.panMapToGeocodedLocation("placenameInput") ;

//check if "google" is defined PLOTS2#4717
google
Copy link
Member

Choose a reason for hiding this comment

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

Does this have to be window.hasOwnProperty('google')?

Copy link
Member Author

@rexagod rexagod Feb 1, 2019

Choose a reason for hiding this comment

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

I tested this snippet @jywarren, there's no need to explicitly check the window object, since google gets binded to it when we include the scripts, but I can go ahead and add this to make the code a bit more semantic. What do you say?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, really? Just running this locally i get:

google ? alert('hi') : alert('bye')
> Uncaught ReferenceError: google is not defined

Sorry, just trying to be extra sure -- and perhaps I misunderstand how this will be run, so happy to learn!

Copy link
Member Author

@rexagod rexagod Feb 6, 2019

Choose a reason for hiding this comment

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

@jywarren I was unable to reproduce this for some reason, google always shows up defined on my local, but binding this to window would be a good step here just to be sure! 🤔 I'll make the changes.

peek 2019-02-06 23-57

Copy link
Member

Choose a reason for hiding this comment

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

is it possible it is actually defined there? Can you try it with, say, a made- up variable name? I think we're watching for when the google library is not included, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like both approaches solved the issue. 😄

screenshot from 2019-02-07 01-26-12

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh! Didn't see your comment there since we both posted at the same time. Looking into this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you try it with, say, a made- up variable name?

screenshot from 2019-02-07 01-34-12

@jywarren jywarren merged commit dc9d0d5 into master Feb 6, 2019
@jywarren
Copy link
Member

jywarren commented Feb 6, 2019

Perfect!!!

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 testing for MapModule's proper construction
2 participants