Discussion:
[dart-misc] Best way to reference a global variable using @JS syntax?
Ryan Gonzalez
2017-08-28 16:40:19 UTC
Permalink
This is literally all I want to do:


@JS('window')
external dynamic window;


except not actually using the window object, but something else.
Except, of course, that code *doesn't work*. Other things I've tried:


@JS('window')
external dynamic window();


and then trying getProperty(window, 'property_here'), except I can't
find the proper property.

I ended up giving up and just doing:


@JS('eval')
external dynamic eval(String expr);
dynamic window = eval('window');


which isn't striking me as very elegant...


What should I do?
--
Ryan (ライアン)
Yoko Shimomura, ryo (supercell/EGOIST), Hiroyuki Sawano >> everyone else
http://refi64.com/
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Florian Loitsch' via Dart Misc
2017-08-30 16:40:56 UTC
Permalink
[+jacobr]
Post by Ryan Gonzalez
@JS('window')
external dynamic window;
except not actually using the window object, but something else.
@JS('window')
external dynamic window();
and then trying getProperty(window, 'property_here'), except I can't
find the proper property.
@JS('eval')
external dynamic eval(String expr);
dynamic window = eval('window');
which isn't striking me as very elegant...
What should I do?
--
Ryan (ラむアン)
Yoko Shimomura, ryo (supercell/EGOIST), Hiroyuki Sawano >> everyone else
http://refi64.com/
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Loading...