| OLD | NEW |
| 1 dart_library.library('dart/js', null, /* Imports */[ | 1 dart_library.library('dart/js', null, /* Imports */[ |
| 2 "dart_runtime/dart", | 2 "dart_runtime/dart", |
| 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 dart.defineLazyProperties(exports, { | 10 dart.defineLazyProperties(exports, { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 static new(constructor, arguments$) { | 21 static new(constructor, arguments$) { |
| 22 if (arguments$ === void 0) | 22 if (arguments$ === void 0) |
| 23 arguments$ = null; | 23 arguments$ = null; |
| 24 let ctor = constructor[_jsObject]; | 24 let ctor = constructor[_jsObject]; |
| 25 if (arguments$ == null) { | 25 if (arguments$ == null) { |
| 26 return dart.as(_wrapToDart(new ctor()), JsObject); | 26 return dart.as(_wrapToDart(new ctor()), JsObject); |
| 27 } | 27 } |
| 28 return dart.as(_wrapToDart(new ctor(...arguments$)), JsObject); | 28 return dart.as(_wrapToDart(new ctor(...arguments$)), JsObject); |
| 29 } | 29 } |
| 30 static fromBrowserObject(object) { | 30 static fromBrowserObject(object) { |
| 31 if (dart.is(object, core.num) || typeof object == 'string' || typeof objec
t == 'boolean' || object == null) { | 31 if (typeof object == 'number' || typeof object == 'string' || typeof objec
t == 'boolean' || object == null) { |
| 32 dart.throw(new core.ArgumentError("object cannot be a num, string, bool,
or null")); | 32 dart.throw(new core.ArgumentError("object cannot be a num, string, bool,
or null")); |
| 33 } | 33 } |
| 34 return dart.as(_wrapToDart(_convertToJS(object)), JsObject); | 34 return dart.as(_wrapToDart(_convertToJS(object)), JsObject); |
| 35 } | 35 } |
| 36 static jsify(object) { | 36 static jsify(object) { |
| 37 if (!dart.is(object, core.Map) && !dart.is(object, core.Iterable)) { | 37 if (!dart.is(object, core.Map) && !dart.is(object, core.Iterable)) { |
| 38 dart.throw(new core.ArgumentError("object must be a Map or Iterable")); | 38 dart.throw(new core.ArgumentError("object must be a Map or Iterable")); |
| 39 } | 39 } |
| 40 return dart.as(_wrapToDart(JsObject._convertDataTree(object)), JsObject); | 40 return dart.as(_wrapToDart(JsObject._convertDataTree(object)), JsObject); |
| 41 } | 41 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 58 convertedList[dartx.addAll](dart.as(dart.dsend(o, 'map', _convert), co
re.Iterable)); | 58 convertedList[dartx.addAll](dart.as(dart.dsend(o, 'map', _convert), co
re.Iterable)); |
| 59 return convertedList; | 59 return convertedList; |
| 60 } else { | 60 } else { |
| 61 return _convertToJS(o); | 61 return _convertToJS(o); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 dart.fn(_convert); | 64 dart.fn(_convert); |
| 65 return _convert(data); | 65 return _convert(data); |
| 66 } | 66 } |
| 67 get(property) { | 67 get(property) { |
| 68 if (!(typeof property == 'string') && !dart.is(property, core.num)) { | 68 if (!(typeof property == 'string') && !(typeof property == 'number')) { |
| 69 dart.throw(new core.ArgumentError("property is not a String or num")); | 69 dart.throw(new core.ArgumentError("property is not a String or num")); |
| 70 } | 70 } |
| 71 return _convertToDart(this[_jsObject][property]); | 71 return _convertToDart(this[_jsObject][property]); |
| 72 } | 72 } |
| 73 set(property, value) { | 73 set(property, value) { |
| 74 if (!(typeof property == 'string') && !dart.is(property, core.num)) { | 74 if (!(typeof property == 'string') && !(typeof property == 'number')) { |
| 75 dart.throw(new core.ArgumentError("property is not a String or num")); | 75 dart.throw(new core.ArgumentError("property is not a String or num")); |
| 76 } | 76 } |
| 77 this[_jsObject][property] = _convertToJS(value); | 77 this[_jsObject][property] = _convertToJS(value); |
| 78 return value; | 78 return value; |
| 79 } | 79 } |
| 80 get hashCode() { | 80 get hashCode() { |
| 81 return 0; | 81 return 0; |
| 82 } | 82 } |
| 83 ['=='](other) { | 83 ['=='](other) { |
| 84 return dart.is(other, JsObject) && this[_jsObject] === dart.dload(other, _
jsObject); | 84 return dart.is(other, JsObject) && this[_jsObject] === dart.dload(other, _
jsObject); |
| 85 } | 85 } |
| 86 hasProperty(property) { | 86 hasProperty(property) { |
| 87 if (!(typeof property == 'string') && !dart.is(property, core.num)) { | 87 if (!(typeof property == 'string') && !(typeof property == 'number')) { |
| 88 dart.throw(new core.ArgumentError("property is not a String or num")); | 88 dart.throw(new core.ArgumentError("property is not a String or num")); |
| 89 } | 89 } |
| 90 return property in this[_jsObject]; | 90 return property in this[_jsObject]; |
| 91 } | 91 } |
| 92 deleteProperty(property) { | 92 deleteProperty(property) { |
| 93 if (!(typeof property == 'string') && !dart.is(property, core.num)) { | 93 if (!(typeof property == 'string') && !(typeof property == 'number')) { |
| 94 dart.throw(new core.ArgumentError("property is not a String or num")); | 94 dart.throw(new core.ArgumentError("property is not a String or num")); |
| 95 } | 95 } |
| 96 delete this[_jsObject][property]; | 96 delete this[_jsObject][property]; |
| 97 } | 97 } |
| 98 instanceof(type) { | 98 instanceof(type) { |
| 99 return this[_jsObject] instanceof _convertToJS(type); | 99 return this[_jsObject] instanceof _convertToJS(type); |
| 100 } | 100 } |
| 101 toString() { | 101 toString() { |
| 102 try { | 102 try { |
| 103 return String(this[_jsObject]); | 103 return String(this[_jsObject]); |
| 104 } catch (e) { | 104 } catch (e) { |
| 105 return super.toString(); | 105 return super.toString(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 } | 108 } |
| 109 callMethod(method, args) { | 109 callMethod(method, args) { |
| 110 if (args === void 0) | 110 if (args === void 0) |
| 111 args = null; | 111 args = null; |
| 112 if (!(typeof method == 'string') && !dart.is(method, core.num)) { | 112 if (!(typeof method == 'string') && !(typeof method == 'number')) { |
| 113 dart.throw(new core.ArgumentError("method is not a String or num")); | 113 dart.throw(new core.ArgumentError("method is not a String or num")); |
| 114 } | 114 } |
| 115 if (args != null) | 115 if (args != null) |
| 116 args = core.List.from(args[dartx.map](_convertToJS)); | 116 args = core.List.from(args[dartx.map](_convertToJS)); |
| 117 let fn = this[_jsObject][method]; | 117 let fn = this[_jsObject][method]; |
| 118 if (!(fn instanceof Function)) { | 118 if (!(fn instanceof Function)) { |
| 119 dart.throw(new core.NoSuchMethodError(this[_jsObject], core.Symbol.new(d
art.as(method, core.String)), args, dart.map())); | 119 dart.throw(new core.NoSuchMethodError(this[_jsObject], core.Symbol.new(d
art.as(method, core.String)), args, dart.map())); |
| 120 } | 120 } |
| 121 return _convertToDart(fn.apply(this[_jsObject], args)); | 121 return _convertToDart(fn.apply(this[_jsObject], args)); |
| 122 } | 122 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 195 } |
| 196 static _checkRange(start, end, length) { | 196 static _checkRange(start, end, length) { |
| 197 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(length
)) { | 197 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(length
)) { |
| 198 dart.throw(new core.RangeError.range(start, 0, length)); | 198 dart.throw(new core.RangeError.range(start, 0, length)); |
| 199 } | 199 } |
| 200 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.
notNull(length)) { | 200 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart.
notNull(length)) { |
| 201 dart.throw(new core.RangeError.range(end, start, length)); | 201 dart.throw(new core.RangeError.range(end, start, length)); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 get(index) { | 204 get(index) { |
| 205 if (dart.is(index, core.num) && index == index[dartx.toInt]()) { | 205 if (typeof index == 'number' && index == index[dartx.toInt]()) { |
| 206 this[_checkIndex](index); | 206 this[_checkIndex](index); |
| 207 } | 207 } |
| 208 return dart.as(super.get(index), E); | 208 return dart.as(super.get(index), E); |
| 209 } | 209 } |
| 210 set(index, value) { | 210 set(index, value) { |
| 211 dart.as(value, E); | 211 dart.as(value, E); |
| 212 if (dart.is(index, core.num) && index == index[dartx.toInt]()) { | 212 if (typeof index == 'number' && index == index[dartx.toInt]()) { |
| 213 this[_checkIndex](index); | 213 this[_checkIndex](index); |
| 214 } | 214 } |
| 215 super.set(index, value); | 215 super.set(index, value); |
| 216 return value; | 216 return value; |
| 217 } | 217 } |
| 218 get length() { | 218 get length() { |
| 219 let len = this[_jsObject].length; | 219 let len = this[_jsObject].length; |
| 220 if (typeof len === "number" && len >>> 0 === len) { | 220 if (typeof len === "number" && len >>> 0 === len) { |
| 221 return len; | 221 return len; |
| 222 } | 222 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 let _dartObj = Symbol('_dartObj'); | 321 let _dartObj = Symbol('_dartObj'); |
| 322 class _DartObject extends core.Object { | 322 class _DartObject extends core.Object { |
| 323 _DartObject(dartObj) { | 323 _DartObject(dartObj) { |
| 324 this[_dartObj] = dartObj; | 324 this[_dartObj] = dartObj; |
| 325 } | 325 } |
| 326 } | 326 } |
| 327 dart.setSignature(_DartObject, { | 327 dart.setSignature(_DartObject, { |
| 328 constructors: () => ({_DartObject: [_DartObject, [dart.dynamic]]}) | 328 constructors: () => ({_DartObject: [_DartObject, [dart.dynamic]]}) |
| 329 }); | 329 }); |
| 330 function _convertToJS(o) { | 330 function _convertToJS(o) { |
| 331 if (o == null || typeof o == 'string' || dart.is(o, core.num) || typeof o ==
'boolean' || dart.notNull(_isBrowserType(o))) { | 331 if (o == null || typeof o == 'string' || typeof o == 'number' || typeof o ==
'boolean' || dart.notNull(_isBrowserType(o))) { |
| 332 return o; | 332 return o; |
| 333 } else if (dart.is(o, core.DateTime)) { | 333 } else if (dart.is(o, core.DateTime)) { |
| 334 return _js_helper.Primitives.lazyAsJsDate(o); | 334 return _js_helper.Primitives.lazyAsJsDate(o); |
| 335 } else if (dart.is(o, JsObject)) { | 335 } else if (dart.is(o, JsObject)) { |
| 336 return dart.dload(o, _jsObject); | 336 return dart.dload(o, _jsObject); |
| 337 } else if (dart.is(o, core.Function)) { | 337 } else if (dart.is(o, core.Function)) { |
| 338 return _putIfAbsent(exports._jsProxies, o, _wrapDartFunction); | 338 return _putIfAbsent(exports._jsProxies, o, _wrapDartFunction); |
| 339 } else { | 339 } else { |
| 340 return _putIfAbsent(exports._jsProxies, o, dart.fn(o => new _DartObject(o)
, _DartObject, [dart.dynamic])); | 340 return _putIfAbsent(exports._jsProxies, o, dart.fn(o => new _DartObject(o)
, _DartObject, [dart.dynamic])); |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 dart.fn(_convertToJS); | 343 dart.fn(_convertToJS); |
| 344 function _wrapDartFunction(f) { | 344 function _wrapDartFunction(f) { |
| 345 let wrapper = function() { | 345 let wrapper = function() { |
| 346 let args = Array.prototype.map.call(arguments, _convertToDart); | 346 let args = Array.prototype.map.call(arguments, _convertToDart); |
| 347 return _convertToJS(f(...args)); | 347 return _convertToJS(f(...args)); |
| 348 }; | 348 }; |
| 349 dart.dsetindex(exports._dartProxies, wrapper, f); | 349 dart.dsetindex(exports._dartProxies, wrapper, f); |
| 350 return wrapper; | 350 return wrapper; |
| 351 } | 351 } |
| 352 dart.fn(_wrapDartFunction); | 352 dart.fn(_wrapDartFunction); |
| 353 function _convertToDart(o) { | 353 function _convertToDart(o) { |
| 354 if (o == null || typeof o == "string" || typeof o == "number" || typeof o ==
"boolean" || dart.notNull(_isBrowserType(o))) { | 354 if (o == null || typeof o == "string" || typeof o == "number" || typeof o ==
"boolean" || dart.notNull(_isBrowserType(o))) { |
| 355 return o; | 355 return o; |
| 356 } else if (o instanceof Date) { | 356 } else if (o instanceof Date) { |
| 357 let ms = o.getTime(); | 357 let ms = o.getTime(); |
| 358 return new core.DateTime.fromMillisecondsSinceEpoch(ms); | 358 return new core.DateTime.fromMillisecondsSinceEpoch(dart.asInt(ms)); |
| 359 } else if (dart.is(o, _DartObject) && dart.jsobject != dart.realRuntimeType(
o)) { | 359 } else if (dart.is(o, _DartObject) && dart.jsobject != dart.realRuntimeType(
o)) { |
| 360 return dart.dload(o, _dartObj); | 360 return dart.dload(o, _dartObj); |
| 361 } else { | 361 } else { |
| 362 return _putIfAbsent(exports._dartProxies, o, _wrapToDart); | 362 return _putIfAbsent(exports._dartProxies, o, _wrapToDart); |
| 363 } | 363 } |
| 364 } | 364 } |
| 365 dart.fn(_convertToDart, core.Object, [dart.dynamic]); | 365 dart.fn(_convertToDart, core.Object, [dart.dynamic]); |
| 366 function _wrapToDart(o) { | 366 function _wrapToDart(o) { |
| 367 if (typeof o == "function") { | 367 if (typeof o == "function") { |
| 368 return new JsFunction._fromJs(o); | 368 return new JsFunction._fromJs(o); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 394 let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(dart.d
ynamic, [E])); | 394 let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(dart.d
ynamic, [E])); |
| 395 return __CastType0; | 395 return __CastType0; |
| 396 }); | 396 }); |
| 397 let __CastType0 = __CastType0$(); | 397 let __CastType0 = __CastType0$(); |
| 398 // Exports: | 398 // Exports: |
| 399 exports.JsObject = JsObject; | 399 exports.JsObject = JsObject; |
| 400 exports.JsFunction = JsFunction; | 400 exports.JsFunction = JsFunction; |
| 401 exports.JsArray$ = JsArray$; | 401 exports.JsArray$ = JsArray$; |
| 402 exports.JsArray = JsArray; | 402 exports.JsArray = JsArray; |
| 403 }); | 403 }); |
| OLD | NEW |