Chromium Code Reviews| Index: sdk/lib/js/dart2js/js_dart2js.dart |
| diff --git a/sdk/lib/js/dart2js/js_dart2js.dart b/sdk/lib/js/dart2js/js_dart2js.dart |
| index 7f806b73f3744794eeca4b725e61093b6cf12008..a9b8afdd90a2634bc2c7bb071152e19cb30b57a7 100644 |
| --- a/sdk/lib/js/dart2js/js_dart2js.dart |
| +++ b/sdk/lib/js/dart2js/js_dart2js.dart |
| @@ -5,10 +5,15 @@ |
| library dart.js; |
| import 'dart:_foreign_helper' show JS; |
| -import 'dart:_js_helper' show convertDartClosureToJS; |
| +import 'dart:_js_helper' show convertDartClosureToJS, computeGlobalThis; |
| +JsObject _context; |
|
vsm
2013/09/28 00:55:09
Can't you just do:
final JsObject context = new J
justinfagnani
2013/09/28 01:02:15
Indeed. I keep forgetting about lazy static initia
|
| + |
| JsObject get context { |
| - return new JsObject._fromJs(JS('=Object', 'window')); |
| + if (_context == null) { |
| + _context = new JsObject._fromJs(computeGlobalThis()); |
| + } |
| + return _context; |
| } |
| JsObject jsify(dynamic data) => data == null ? null : new JsObject._json(data); |