| 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 dart.defineLazyProperties(exports, { | 10 dart.defineLazyProperties(exports, { |
| 11 get context() { | 11 get context() { |
| 12 return _wrapToDart(dart.global); | 12 return _wrapToDart(dart.global); |
| 13 } | 13 } |
| 14 }); | 14 }); |
| 15 const _jsObject = Symbol('_jsObject'); | 15 const _jsObject = Symbol('_jsObject'); |
| 16 class JsObject extends core.Object { | 16 class JsObject extends core.Object { |
| 17 _fromJs(jsObject) { | 17 _fromJs(jsObject) { |
| 18 this[_jsObject] = jsObject; | 18 this[_jsObject] = jsObject; |
| 19 dart.assert(this[_jsObject] != null); | 19 dart.assert(this[_jsObject] != null); |
| 20 } | 20 } |
| 21 static new(constructor, arguments$) { | 21 static new(constructor, arguments$) { |
| 22 if (arguments$ === void 0) | 22 if (arguments$ === void 0) arguments$ = null; |
| 23 arguments$ = null; | |
| 24 let ctor = constructor[_jsObject]; | 23 let ctor = constructor[_jsObject]; |
| 25 if (arguments$ == null) { | 24 if (arguments$ == null) { |
| 26 return _wrapToDart(new ctor()); | 25 return _wrapToDart(new ctor()); |
| 27 } | 26 } |
| 28 return _wrapToDart(new ctor(...arguments$)); | 27 return _wrapToDart(new ctor(...arguments$)); |
| 29 } | 28 } |
| 30 static fromBrowserObject(object) { | 29 static fromBrowserObject(object) { |
| 31 if (typeof object == 'number' || typeof object == 'string' || typeof objec
t == 'boolean' || object == null) { | 30 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")); | 31 dart.throw(new core.ArgumentError("object cannot be a num, string, bool,
or null")); |
| 33 } | 32 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 99 } |
| 101 toString() { | 100 toString() { |
| 102 try { | 101 try { |
| 103 return String(this[_jsObject]); | 102 return String(this[_jsObject]); |
| 104 } catch (e) { | 103 } catch (e) { |
| 105 return super.toString(); | 104 return super.toString(); |
| 106 } | 105 } |
| 107 | 106 |
| 108 } | 107 } |
| 109 callMethod(method, args) { | 108 callMethod(method, args) { |
| 110 if (args === void 0) | 109 if (args === void 0) args = null; |
| 111 args = null; | |
| 112 if (!(typeof method == 'string') && !(typeof method == 'number')) { | 110 if (!(typeof method == 'string') && !(typeof method == 'number')) { |
| 113 dart.throw(new core.ArgumentError("method is not a String or num")); | 111 dart.throw(new core.ArgumentError("method is not a String or num")); |
| 114 } | 112 } |
| 115 if (args != null) | 113 if (args != null) args = core.List.from(args[dartx.map](_convertToJS)); |
| 116 args = core.List.from(args[dartx.map](_convertToJS)); | |
| 117 let fn = this[_jsObject][method]; | 114 let fn = this[_jsObject][method]; |
| 118 if (!(fn instanceof Function)) { | 115 if (!(fn instanceof Function)) { |
| 119 dart.throw(new core.NoSuchMethodError(this[_jsObject], core.Symbol.new(d
art.as(method, core.String)), args, dart.map())); | 116 dart.throw(new core.NoSuchMethodError(this[_jsObject], core.Symbol.new(d
art.as(method, core.String)), args, dart.map())); |
| 120 } | 117 } |
| 121 return _convertToDart(fn.apply(this[_jsObject], args)); | 118 return _convertToDart(fn.apply(this[_jsObject], args)); |
| 122 } | 119 } |
| 123 } | 120 } |
| 124 dart.defineNamedConstructor(JsObject, '_fromJs'); | 121 dart.defineNamedConstructor(JsObject, '_fromJs'); |
| 125 dart.setSignature(JsObject, { | 122 dart.setSignature(JsObject, { |
| 126 constructors: () => ({ | 123 constructors: () => ({ |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 insert(index, element) { | 234 insert(index, element) { |
| 238 dart.as(element, E); | 235 dart.as(element, E); |
| 239 this[_checkInsertIndex](index); | 236 this[_checkInsertIndex](index); |
| 240 this.callMethod('splice', [index, 0, element]); | 237 this.callMethod('splice', [index, 0, element]); |
| 241 } | 238 } |
| 242 removeAt(index) { | 239 removeAt(index) { |
| 243 this[_checkIndex](index); | 240 this[_checkIndex](index); |
| 244 return dart.as(dart.dindex(this.callMethod('splice', [index, 1]), 0), E)
; | 241 return dart.as(dart.dindex(this.callMethod('splice', [index, 1]), 0), E)
; |
| 245 } | 242 } |
| 246 removeLast() { | 243 removeLast() { |
| 247 if (this.length == 0) | 244 if (this.length == 0) dart.throw(new core.RangeError(-1)); |
| 248 dart.throw(new core.RangeError(-1)); | |
| 249 return dart.as(this.callMethod('pop'), E); | 245 return dart.as(this.callMethod('pop'), E); |
| 250 } | 246 } |
| 251 removeRange(start, end) { | 247 removeRange(start, end) { |
| 252 JsArray$()._checkRange(start, end, this.length); | 248 JsArray$()._checkRange(start, end, this.length); |
| 253 this.callMethod('splice', [start, dart.notNull(end) - dart.notNull(start
)]); | 249 this.callMethod('splice', [start, dart.notNull(end) - dart.notNull(start
)]); |
| 254 } | 250 } |
| 255 setRange(start, end, iterable, skipCount) { | 251 setRange(start, end, iterable, skipCount) { |
| 256 dart.as(iterable, core.Iterable$(E)); | 252 dart.as(iterable, core.Iterable$(E)); |
| 257 if (skipCount === void 0) | 253 if (skipCount === void 0) skipCount = 0; |
| 258 skipCount = 0; | |
| 259 JsArray$()._checkRange(start, end, this.length); | 254 JsArray$()._checkRange(start, end, this.length); |
| 260 let length = dart.notNull(end) - dart.notNull(start); | 255 let length = dart.notNull(end) - dart.notNull(start); |
| 261 if (length == 0) | 256 if (length == 0) return; |
| 262 return; | 257 if (dart.notNull(skipCount) < 0) dart.throw(new core.ArgumentError(skipC
ount)); |
| 263 if (dart.notNull(skipCount) < 0) | |
| 264 dart.throw(new core.ArgumentError(skipCount)); | |
| 265 let args = [start, length]; | 258 let args = [start, length]; |
| 266 args[dartx.addAll](iterable[dartx.skip](skipCount)[dartx.take](length)); | 259 args[dartx.addAll](iterable[dartx.skip](skipCount)[dartx.take](length)); |
| 267 this.callMethod('splice', args); | 260 this.callMethod('splice', args); |
| 268 } | 261 } |
| 269 sort(compare) { | 262 sort(compare) { |
| 270 if (compare === void 0) | 263 if (compare === void 0) compare = null; |
| 271 compare = null; | |
| 272 dart.as(compare, dart.functionType(core.int, [E, E])); | 264 dart.as(compare, dart.functionType(core.int, [E, E])); |
| 273 this.callMethod('sort', compare == null ? [] : [compare]); | 265 this.callMethod('sort', compare == null ? [] : [compare]); |
| 274 } | 266 } |
| 275 } | 267 } |
| 276 dart.defineNamedConstructor(JsArray, 'from'); | 268 dart.defineNamedConstructor(JsArray, 'from'); |
| 277 dart.defineNamedConstructor(JsArray, '_fromJs'); | 269 dart.defineNamedConstructor(JsArray, '_fromJs'); |
| 278 dart.setSignature(JsArray, { | 270 dart.setSignature(JsArray, { |
| 279 constructors: () => ({ | 271 constructors: () => ({ |
| 280 JsArray: [JsArray$(E), []], | 272 JsArray: [JsArray$(E), []], |
| 281 from: [JsArray$(E), [core.Iterable$(E)]], | 273 from: [JsArray$(E), [core.Iterable$(E)]], |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 }); | 407 }); |
| 416 let __CastType0 = __CastType0$(); | 408 let __CastType0 = __CastType0$(); |
| 417 // Exports: | 409 // Exports: |
| 418 exports.JsObject = JsObject; | 410 exports.JsObject = JsObject; |
| 419 exports.JsFunction = JsFunction; | 411 exports.JsFunction = JsFunction; |
| 420 exports.JsArray$ = JsArray$; | 412 exports.JsArray$ = JsArray$; |
| 421 exports.JsArray = JsArray; | 413 exports.JsArray = JsArray; |
| 422 exports.allowInterop = allowInterop; | 414 exports.allowInterop = allowInterop; |
| 423 exports.allowInteropCaptureThis = allowInteropCaptureThis; | 415 exports.allowInteropCaptureThis = allowInteropCaptureThis; |
| 424 }); | 416 }); |
| OLD | NEW |