-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Need a way to import libraries by name without polluting the global JS namespace. #25318
Comments
I think I have found why I can't use this code:
It's because dart2js creates some global variable
so when my generated code tries to call |
You are correct. For now use somewhat long names for the imported JS libraries to avoid collisions with minified dart2js names. In the future we'll give Dart2JS a list of names to avoid minifying to so this isn't an issue. |
@jacob314 I have added
it fails on this line:
|
When I try to repro I get blocked running pub get. Is the pubspec not Resolving dependencies...
On Mon, Dec 28, 2015 at 11:24 AM, Paul Annekov notifications@github.com
|
@jacob314 I have updated the code to make it work for you. Just run |
Thanks Paul. Here's a patch that makes the code work in Dartium and Dart2js. The issue is the Leaflet library copies |
Thanks for workaround. Will wait for a clean fix. You can rename issue name to something more relevant. |
Duplicate of #25059 |
Describe the issue you're seeing
I'm porting Leaflet library to Dart for my own needs.
The code in gist works fine for Chrome, but not for Dartium. In Dartium I get the following exception:
I tried to add
@JS('L')
beforelibrary ...;
and remove direct names of functions in JS annotations frommap
,latLng
andtileLayer
. But when I did it, the page stopped working in both browsers %). I start to get the following exception in Chrome:P.S. Porting procedure is a pain. No docs, ugly stack trace on exceptions...
Does it happen in Dartium or when compiled to JavaScript?
Only in Dartium
Dart VM version:
1.13.1 (Thu Dec 17 14:42:19 2015) on "linux_x64"
0.6.0
Failing code: https://gist.github.com/PaulAnnekov/df319b5d58926a196eb5
The text was updated successfully, but these errors were encountered: