Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: sdk/lib/js/dartium/js_dartium.dart

Issue 46533003: Add Event and Window to transferrable types (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/js/dart2js/js_dart2js.dart ('k') | tests/html/js_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 * 53 *
54 * Functions and closures are proxied in such a way that they are callable. A 54 * Functions and closures are proxied in such a way that they are callable. A
55 * Dart closure assigned to a JavaScript property is proxied by a function in 55 * Dart closure assigned to a JavaScript property is proxied by a function in
56 * JavaScript. A JavaScript function accessed from Dart is proxied by a 56 * JavaScript. A JavaScript function accessed from Dart is proxied by a
57 * [JsFunction], which has a [apply] method to invoke it. 57 * [JsFunction], which has a [apply] method to invoke it.
58 * 58 *
59 * The following types are transferred directly and not proxied: 59 * The following types are transferred directly and not proxied:
60 * 60 *
61 * * "Basic" types: `null`, `bool`, `num`, `String`, `DateTime` 61 * * "Basic" types: `null`, `bool`, `num`, `String`, `DateTime`
62 * * `Blob` 62 * * `Blob`
63 * * `Event`
64 * * `HtmlCollection`
65 * * `ImageData`
63 * * `KeyRange` 66 * * `KeyRange`
64 * * `ImageData` 67 * * `Node`
68 * * `NodeList`
65 * * `TypedData`, including its subclasses like `Int32List`, but _not_ 69 * * `TypedData`, including its subclasses like `Int32List`, but _not_
66 * `ByteBuffer` 70 * `ByteBuffer`
67 * * `Node` 71 * * `Window`
68 * 72 *
69 * ## Converting collections with JsObject.jsify() 73 * ## Converting collections with JsObject.jsify()
70 * 74 *
71 * To create a JavaScript collection from a Dart collection use the 75 * To create a JavaScript collection from a Dart collection use the
72 * [JsObject.jsify] constructor, which converts Dart [Map]s and [Iterable]s 76 * [JsObject.jsify] constructor, which converts Dart [Map]s and [Iterable]s
73 * into JavaScript Objects and Arrays. 77 * into JavaScript Objects and Arrays.
74 * 78 *
75 * The following expression creats a new JavaScript object with the properties 79 * The following expression creats a new JavaScript object with the properties
76 * `a` and `b` defined: 80 * `a` and `b` defined:
77 * 81 *
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 * Primitives and other transferrable values are directly converted to their 146 * Primitives and other transferrable values are directly converted to their
143 * JavaScript type, and all other objects are proxied. 147 * JavaScript type, and all other objects are proxied.
144 */ 148 */
145 factory JsObject.jsify(object) { 149 factory JsObject.jsify(object) {
146 if ((object is! Map) && (object is! Iterable)) { 150 if ((object is! Map) && (object is! Iterable)) {
147 throw new ArgumentError("object must be a Map or Iterable"); 151 throw new ArgumentError("object must be a Map or Iterable");
148 } 152 }
149 return _jsify(object); 153 return _jsify(object);
150 } 154 }
151 155
152 static JSObject _jsify(object) native "JsObject_jsify"; 156 static JsObject _jsify(object) native "JsObject_jsify";
153 157
154 static JsObject _fromBrowserObject(object) native "JsObject_fromBrowserObject" ; 158 static JsObject _fromBrowserObject(object) native "JsObject_fromBrowserObject" ;
155 159
156 /** 160 /**
157 * Returns the value associated with [property] from the proxied JavaScript 161 * Returns the value associated with [property] from the proxied JavaScript
158 * object. 162 * object.
159 * 163 *
160 * The type of [property] must be either [String] or [num]. 164 * The type of [property] must be either [String] or [num].
161 */ 165 */
162 operator[](property) native "JsObject_[]"; 166 operator[](property) native "JsObject_[]";
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 /** 373 /**
370 * Returns a method that can be called with an arbitrary number (for n less 374 * Returns a method that can be called with an arbitrary number (for n less
371 * than 11) of arguments without violating Dart type checks. 375 * than 11) of arguments without violating Dart type checks.
372 */ 376 */
373 Function _wrapAsDebuggerVarArgsFunction(JsFunction jsFunction) => 377 Function _wrapAsDebuggerVarArgsFunction(JsFunction jsFunction) =>
374 ([a1=_UNDEFINED, a2=_UNDEFINED, a3=_UNDEFINED, a4=_UNDEFINED, 378 ([a1=_UNDEFINED, a2=_UNDEFINED, a3=_UNDEFINED, a4=_UNDEFINED,
375 a5=_UNDEFINED, a6=_UNDEFINED, a7=_UNDEFINED, a8=_UNDEFINED, 379 a5=_UNDEFINED, a6=_UNDEFINED, a7=_UNDEFINED, a8=_UNDEFINED,
376 a9=_UNDEFINED, a10=_UNDEFINED]) => 380 a9=_UNDEFINED, a10=_UNDEFINED]) =>
377 jsFunction._applyDebuggerOnly(_stripUndefinedArgs( 381 jsFunction._applyDebuggerOnly(_stripUndefinedArgs(
378 [a1,a2,a3,a4,a5,a6,a7,a8,a9,a10])); 382 [a1,a2,a3,a4,a5,a6,a7,a8,a9,a10]));
OLDNEW
« no previous file with comments | « sdk/lib/js/dart2js/js_dart2js.dart ('k') | tests/html/js_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698