| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Support for interoperating with JavaScript. | 6 * Support for interoperating with JavaScript. |
| 7 * | 7 * |
| 8 * This library provides access to JavaScript objects from Dart, allowing | 8 * This library provides access to JavaScript objects from Dart, allowing |
| 9 * Dart code to get and set properties, and call methods of JavaScript objects | 9 * Dart code to get and set properties, and call methods of JavaScript objects |
| 10 * and invoke JavaScript functions. The library takes care of converting | 10 * and invoke JavaScript functions. The library takes care of converting |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 if (JS('bool', '# == null', o) || | 480 if (JS('bool', '# == null', o) || |
| 481 JS('bool', 'typeof # == "string"', o) || | 481 JS('bool', 'typeof # == "string"', o) || |
| 482 JS('bool', 'typeof # == "number"', o) || | 482 JS('bool', 'typeof # == "number"', o) || |
| 483 JS('bool', 'typeof # == "boolean"', o) || | 483 JS('bool', 'typeof # == "boolean"', o) || |
| 484 _isBrowserType(o)) { | 484 _isBrowserType(o)) { |
| 485 return o; | 485 return o; |
| 486 } else if (JS('bool', '# instanceof Date', o)) { | 486 } else if (JS('bool', '# instanceof Date', o)) { |
| 487 var ms = JS('num', '#.getTime()', o); | 487 var ms = JS('num', '#.getTime()', o); |
| 488 return new DateTime.fromMillisecondsSinceEpoch(ms); | 488 return new DateTime.fromMillisecondsSinceEpoch(ms); |
| 489 } else if (o is _DartObject && | 489 } else if (o is _DartObject && |
| 490 JS('bool', 'dart.jsobject != dart.realRuntimeType(#)', o)) { | 490 JS('bool', 'dart.jsobject != dart.getReifiedType(#)', o)) { |
| 491 return o._dartObj; | 491 return o._dartObj; |
| 492 } else { | 492 } else { |
| 493 return _putIfAbsent(_dartProxies, o, _wrapToDart); | 493 return _putIfAbsent(_dartProxies, o, _wrapToDart); |
| 494 } | 494 } |
| 495 } | 495 } |
| 496 | 496 |
| 497 JsObject _wrapToDart(o) { | 497 JsObject _wrapToDart(o) { |
| 498 if (JS('bool', 'typeof # == "function"', o)) { | 498 if (JS('bool', 'typeof # == "function"', o)) { |
| 499 return new JsFunction._fromJs(o); | 499 return new JsFunction._fromJs(o); |
| 500 } | 500 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 ' for (let arg of arguments) {' | 550 ' for (let arg of arguments) {' |
| 551 ' args.push(arg);' | 551 ' args.push(arg);' |
| 552 ' }' | 552 ' }' |
| 553 ' return #(...args);' | 553 ' return #(...args);' |
| 554 '}', | 554 '}', |
| 555 f); | 555 f); |
| 556 _interopCaptureThisExpando[f] = ret; | 556 _interopCaptureThisExpando[f] = ret; |
| 557 } | 557 } |
| 558 return ret; | 558 return ret; |
| 559 } | 559 } |
| OLD | NEW |