-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Allow to specify an objectToExportTo for goog.exportSymbol #2082
Conversation
I like the sound of this. I think I'd call it namespace instead of objectToExportTo. Looks like there is a stray debugger in there. I'd like to give this a proper review but am not in a place to do so now. |
I removed the stray debugger, thanks for the catch. The |
@ahocevar it looks like 0d21d45 is missing the changes to Here's my thinking on using
Basically, I just think the name |
I agree with @tschaub on the naming here |
Ok, you got me convinced. |
This allows users to build ol3 without anything exposed in the global namespace. This can e.g. be useful for creating an ol3 AMD module, by simply using a build configuration with "define('ol',function(){var o={};%output%return o.ol;});" as "output_wrapper".
I updated the pull request now, and also added the changes to generate-exports.js. I'll add another commit which mentions the new config option in the readme. |
Readme updated. This is now ready for a final review. |
Looks great @ahocevar. Here are my comments in form of commits: https://github.com/tschaub/ol3/compare/ahocevar:custom-exports-target...custom-exports-target I updated the namespace example to use a namespace less likely to collide with a name already used by the compiler. In a full build that I just ran, the compiler used 29 single letter names in the global namespace, so ~55% chance of collision with a single letter namespace (meaning the compiler would redefine the namespace provided in the wrapper - this is only a rough probability because it doesn't look like the compiler uses Anyway, this is a nice enhancement. |
People should be discouraged from exporting to single letter namespaces to avoid collissions with the symbols generated by the compiler.
Thanks for the improvements @tschaub! |
Allow to specify an objectToExportTo for goog.exportSymbol
This allows users to build ol3 without anything exposed in the global namespace. This can e.g. be useful for creating an ol3 AMD module, by simply using a build configuration that contains