OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 } | 251 } |
252 } | 252 } |
253 }); | 253 }); |
254 } | 254 } |
255 } | 255 } |
256 | 256 |
257 _finalizeJsInterfaces() native "Js_finalizeJsInterfaces"; | 257 _finalizeJsInterfaces() native "Js_finalizeJsInterfaces"; |
258 | 258 |
259 String _getJsName(mirrors.DeclarationMirror mirror) { | 259 String _getJsName(mirrors.DeclarationMirror mirror) { |
260 for (var annotation in mirror.metadata) { | 260 for (var annotation in mirror.metadata) { |
261 if (mirrors.MirrorSystem.getName(annotation.type.simpleName) == "Js") { | 261 if (mirrors.MirrorSystem.getName(annotation.type.simpleName) == "JS") { |
262 mirrors.LibraryMirror library = annotation.type.owner; | 262 mirrors.LibraryMirror library = annotation.type.owner; |
263 var uri = library.uri; | 263 var uri = library.uri; |
264 // make sure the annotation is from package://js | 264 // make sure the annotation is from package://js |
265 if (uri.scheme == 'package' && uri.path == 'js/js.dart') { | 265 if (uri.scheme == 'package' && uri.path == 'js/js.dart') { |
266 try { | 266 try { |
267 var name = annotation.reflectee.name; | 267 var name = annotation.reflectee.name; |
268 return name != null ? name : ""; | 268 return name != null ? name : ""; |
269 } catch (e) { | 269 } catch (e) { |
270 } | 270 } |
271 } | 271 } |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 return f; | 1174 return f; |
1175 } else { | 1175 } else { |
1176 var ret = _interopCaptureThisExpando[f]; | 1176 var ret = _interopCaptureThisExpando[f]; |
1177 if (ret == null) { | 1177 if (ret == null) { |
1178 ret = new JsFunction.withThis(f); | 1178 ret = new JsFunction.withThis(f); |
1179 _interopCaptureThisExpando[f] = ret; | 1179 _interopCaptureThisExpando[f] = ret; |
1180 } | 1180 } |
1181 return ret; | 1181 return ret; |
1182 } | 1182 } |
1183 } | 1183 } |
OLD | NEW |