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 library polymer.lib.src.common.js_proxy; | 4 library polymer.lib.src.common.js_proxy; |
5 | 5 |
6 import 'dart:js'; | 6 import 'dart:js'; |
7 import 'package:polymer_interop/polymer_interop.dart'; | 7 import 'package:polymer_interop/polymer_interop.dart'; |
8 export 'package:polymer_interop/polymer_interop.dart' show dartValue, jsValue; | 8 export 'package:polymer_interop/polymer_interop.dart' show dartValue, jsValue; |
9 import 'package:reflectable/reflectable.dart'; | 9 import 'package:reflectable/reflectable.dart'; |
10 import 'behavior.dart'; | 10 import 'behavior.dart'; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 : super( | 61 : super( |
62 instanceInvokeCapability, | 62 instanceInvokeCapability, |
63 metadataCapability, | 63 metadataCapability, |
64 declarationsCapability, | 64 declarationsCapability, |
65 typeCapability, | 65 typeCapability, |
66 typeRelationsCapability, | 66 typeRelationsCapability, |
67 subtypeQuantifyCapability, | 67 subtypeQuantifyCapability, |
68 superclassQuantifyCapability, | 68 superclassQuantifyCapability, |
69 const StaticInvokeCapability('hostAttributes')); | 69 const StaticInvokeCapability('hostAttributes')); |
70 } | 70 } |
71 | |
72 const jsProxyReflectable = const JsProxyReflectable(); | 71 const jsProxyReflectable = const JsProxyReflectable(); |
73 | 72 |
74 final JsObject _polymerDart = context['Polymer']['Dart']; | 73 final JsObject _polymerDart = context['Polymer']['Dart']; |
75 | 74 |
76 /// Given a dart type, this creates a javascript constructor and prototype | 75 /// Given a dart type, this creates a javascript constructor and prototype |
77 /// which can act as a proxy for it. | 76 /// which can act as a proxy for it. |
78 JsFunction _buildJsConstructorForType(Type dartType) { | 77 JsFunction _buildJsConstructorForType(Type dartType) { |
79 var constructor = _polymerDart.callMethod('functionFactory'); | 78 var constructor = _polymerDart.callMethod('functionFactory'); |
80 var prototype = new JsObject(context['Object']); | 79 var prototype = new JsObject(context['Object']); |
81 | 80 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 var mirror = jsProxyReflectable.reflect(dartInstance); | 116 var mirror = jsProxyReflectable.reflect(dartInstance); |
118 return jsValue(mirror.invoke(name, newArgs)); | 117 return jsValue(mirror.invoke(name, newArgs)); |
119 } | 118 } |
120 ]); | 119 ]); |
121 } | 120 } |
122 }); | 121 }); |
123 | 122 |
124 constructor['prototype'] = prototype; | 123 constructor['prototype'] = prototype; |
125 return constructor; | 124 return constructor; |
126 } | 125 } |
OLD | NEW |