-
Notifications
You must be signed in to change notification settings - Fork 41
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
Change this
to window
#4
Comments
I feel like the root of this is an issue with Browserify. The other thing that I'm possibly game to do (some time after 6/16) is to add a UMD wrapper around everything–but I haven't any clue how to make that happen with Closure explicitly setting things on the global object. Basically, the output has been mostly opaque to me since I built this. At this point it's not much more than a fancy wrapper around the installation instructions that exist in the libphonenumber readme–what I've done is hardly additive. (And more, reductive, which means to me that the Google libphonenumber output is at the wrong level of abstraction.) |
Using https://github.com/thlorenz/browserify-shim I was able to patch your library in (it does the replacing of |
I ended up with this, and it makes me sad:
|
That's gross. |
As a compromise between not making assumptions about the environment but still supporting browserify (and anything else that has an undefined global object), what if you did |
In https://github.com/nathanhammond/libphonenumber/blob/master/dist/libphonenumber.js#L1 the very first line is
var aa = this
. When using your library withbrowserify
, your library will be in a closure whose context is not the window, but insteadundefined
.Can you just change it to
var aa = window
? I'm sure this could be fixed in closure too, but I don't know that code well enough to open the issue.The text was updated successfully, but these errors were encountered: