OLD | NEW |
1 dart_library.library('dart/js', null, /* Imports */[ | 1 dart_library.library('dart/js', null, /* Imports */[ |
2 "dart/_runtime", | 2 "dart/_runtime", |
3 'dart/core', | 3 'dart/core', |
4 'dart/collection', | 4 'dart/collection', |
5 'dart/_js_helper' | 5 'dart/_js_helper' |
6 ], /* Lazy imports */[ | 6 ], /* Lazy imports */[ |
7 ], function(exports, dart, core, collection, _js_helper) { | 7 ], function(exports, dart, core, collection, _js_helper) { |
8 'use strict'; | 8 'use strict'; |
9 let dartx = dart.dartx; | 9 let dartx = dart.dartx; |
| 10 const _global = dart.global; |
10 dart.defineLazyProperties(exports, { | 11 dart.defineLazyProperties(exports, { |
11 get context() { | 12 get context() { |
12 return _wrapToDart(dart.global); | 13 return _wrapToDart(_global); |
13 } | 14 } |
14 }); | 15 }); |
15 const _jsObject = Symbol('_jsObject'); | 16 const _jsObject = Symbol('_jsObject'); |
16 class JsObject extends core.Object { | 17 class JsObject extends core.Object { |
17 _fromJs(jsObject) { | 18 _fromJs(jsObject) { |
18 this[_jsObject] = jsObject; | 19 this[_jsObject] = jsObject; |
19 dart.assert(this[_jsObject] != null); | 20 dart.assert(this[_jsObject] != null); |
20 } | 21 } |
21 static new(constructor, arguments$) { | 22 static new(constructor, arguments$) { |
22 if (arguments$ === void 0) | 23 if (arguments$ === void 0) |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 dart.fn(_convertToJS); | 344 dart.fn(_convertToJS); |
344 function _wrapDartFunction(f) { | 345 function _wrapDartFunction(f) { |
345 let wrapper = function() { | 346 let wrapper = function() { |
346 let args = Array.prototype.map.call(arguments, _convertToDart); | 347 let args = Array.prototype.map.call(arguments, _convertToDart); |
347 return _convertToJS(f(...args)); | 348 return _convertToJS(f(...args)); |
348 }; | 349 }; |
349 dart.dsetindex(_dartProxies, wrapper, f); | 350 dart.dsetindex(_dartProxies, wrapper, f); |
350 return wrapper; | 351 return wrapper; |
351 } | 352 } |
352 dart.fn(_wrapDartFunction); | 353 dart.fn(_wrapDartFunction); |
353 function _convertToDart(o) { | 354 function _convertToDart(o, isBrowserType) { |
354 if (o == null || typeof o == "string" || typeof o == "number" || typeof o ==
"boolean" || dart.notNull(_isBrowserType(o))) { | 355 if (isBrowserType === void 0) |
| 356 isBrowserType = null; |
| 357 if (isBrowserType == null) |
| 358 isBrowserType = _isBrowserType; |
| 359 if (o == null || typeof o == "string" || typeof o == "number" || typeof o ==
"boolean" || dart.notNull(dart.dcall(isBrowserType, o))) { |
355 return o; | 360 return o; |
356 } else if (o instanceof Date) { | 361 } else if (o instanceof Date) { |
357 let ms = o.getTime(); | 362 let ms = o.getTime(); |
358 return new core.DateTime.fromMillisecondsSinceEpoch(dart.asInt(ms)); | 363 return new core.DateTime.fromMillisecondsSinceEpoch(dart.asInt(ms)); |
359 } else if (dart.is(o, _DartObject) && dart.jsobject != dart.realRuntimeType(
o)) { | 364 } else if (dart.is(o, _DartObject) && dart.jsobject != dart.realRuntimeType(
o)) { |
360 return dart.dload(o, _dartObj); | 365 return dart.dload(o, _dartObj); |
361 } else { | 366 } else { |
362 return _putIfAbsent(_dartProxies, o, _wrapToDart); | 367 return _putIfAbsent(_dartProxies, o, _wrapToDart); |
363 } | 368 } |
364 } | 369 } |
365 dart.fn(_convertToDart, core.Object, [dart.dynamic]); | 370 dart.fn(_convertToDart, core.Object, [dart.dynamic], [dart.functionType(core.b
ool, [dart.dynamic])]); |
366 function _wrapToDart(o) { | 371 function _wrapToDart(o) { |
367 if (typeof o == "function") { | 372 if (typeof o == "function") { |
368 return new JsFunction._fromJs(o); | 373 return new JsFunction._fromJs(o); |
369 } | 374 } |
370 if (o instanceof Array) { | 375 if (o instanceof Array) { |
371 return new JsArray._fromJs(o); | 376 return new JsArray._fromJs(o); |
372 } | 377 } |
373 return new JsObject._fromJs(o); | 378 return new JsObject._fromJs(o); |
374 } | 379 } |
375 dart.fn(_wrapToDart, JsObject, [dart.dynamic]); | 380 dart.fn(_wrapToDart, JsObject, [dart.dynamic]); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 }); | 420 }); |
416 let __CastType0 = __CastType0$(); | 421 let __CastType0 = __CastType0$(); |
417 // Exports: | 422 // Exports: |
418 exports.JsObject = JsObject; | 423 exports.JsObject = JsObject; |
419 exports.JsFunction = JsFunction; | 424 exports.JsFunction = JsFunction; |
420 exports.JsArray$ = JsArray$; | 425 exports.JsArray$ = JsArray$; |
421 exports.JsArray = JsArray; | 426 exports.JsArray = JsArray; |
422 exports.allowInterop = allowInterop; | 427 exports.allowInterop = allowInterop; |
423 exports.allowInteropCaptureThis = allowInteropCaptureThis; | 428 exports.allowInteropCaptureThis = allowInteropCaptureThis; |
424 }); | 429 }); |
OLD | NEW |