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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 } | 800 } |
801 } | 801 } |
802 | 802 |
803 // Methods required by ListMixin | 803 // Methods required by ListMixin |
804 | 804 |
805 E operator [](index) { | 805 E operator [](index) { |
806 if (index is int) { | 806 if (index is int) { |
807 _checkIndex(index); | 807 _checkIndex(index); |
808 } | 808 } |
809 | 809 |
810 return super[index]; | 810 // Lazily create the Dart class that wraps the JS object when the object in |
| 811 // a list if fetched. |
| 812 var wrap_entry = html.wrap_jso(super[index]); |
| 813 super[index] = wrap_entry; |
| 814 return wrap_entry; |
811 } | 815 } |
812 | 816 |
813 void operator []=(index, E value) { | 817 void operator []=(index, E value) { |
814 if (index is int) { | 818 if (index is int) { |
815 _checkIndex(index); | 819 _checkIndex(index); |
816 } | 820 } |
817 super[index] = value; | 821 super[index] = value; |
818 } | 822 } |
819 | 823 |
820 int get length native "JsArray_length"; | 824 int get length native "JsArray_length"; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 | 885 |
882 /** | 886 /** |
883 * Returns a method that can be called with an arbitrary number (for n less | 887 * Returns a method that can be called with an arbitrary number (for n less |
884 * than 11) of arguments without violating Dart type checks. | 888 * than 11) of arguments without violating Dart type checks. |
885 */ | 889 */ |
886 Function _wrapAsDebuggerVarArgsFunction(JsFunction jsFunction) => | 890 Function _wrapAsDebuggerVarArgsFunction(JsFunction jsFunction) => |
887 ([a1 = _UNDEFINED, a2 = _UNDEFINED, a3 = _UNDEFINED, a4 = _UNDEFINED, | 891 ([a1 = _UNDEFINED, a2 = _UNDEFINED, a3 = _UNDEFINED, a4 = _UNDEFINED, |
888 a5 = _UNDEFINED, a6 = _UNDEFINED, a7 = _UNDEFINED, a8 = _UNDEFINED, | 892 a5 = _UNDEFINED, a6 = _UNDEFINED, a7 = _UNDEFINED, a8 = _UNDEFINED, |
889 a9 = _UNDEFINED, a10 = _UNDEFINED]) => jsFunction._applyDebuggerOnly( | 893 a9 = _UNDEFINED, a10 = _UNDEFINED]) => jsFunction._applyDebuggerOnly( |
890 _stripUndefinedArgs([a1, a2, a3, a4, a5, a6, a7, a8, a9, a10])); | 894 _stripUndefinedArgs([a1, a2, a3, a4, a5, a6, a7, a8, a9, a10])); |
OLD | NEW |