-
Notifications
You must be signed in to change notification settings - Fork 130
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
Conversation
src/modules/PublicLab.MapModule.js
Outdated
_module.blurredLocation.panMapToGeocodedLocation("placenameInput") ; | ||
|
||
//check if "google" is defined PLOTS2#4717 | ||
There was a problem hiding this comment.
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')?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect!!! |
Fixes publiclab/plots2#4717
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
grunt jasmine
fixes #0000
-style reference to original issue #@publiclab/reviewers
for help, in a comment belowIf 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!