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

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

Issue 2850783002: Dart SDK Spelling b, c, and d. (Closed)
Patch Set: Created 3 years, 7 months 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
« no previous file with comments | « sdk/lib/js/dart2js/js_dart2js.dart ('k') | tests/benchmark_smoke/benchmark_base.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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 * * `TypedData`, including its subclasses like `Int32List`, but _not_ 69 * * `TypedData`, including its subclasses like `Int32List`, but _not_
70 * `ByteBuffer` 70 * `ByteBuffer`
71 * * `Window` 71 * * `Window`
72 * 72 *
73 * ## Converting collections with JsObject.jsify() 73 * ## Converting collections with JsObject.jsify()
74 * 74 *
75 * To create a JavaScript collection from a Dart collection use the 75 * To create a JavaScript collection from a Dart collection use the
76 * [JsObject.jsify] constructor, which converts Dart [Map]s and [Iterable]s 76 * [JsObject.jsify] constructor, which converts Dart [Map]s and [Iterable]s
77 * into JavaScript Objects and Arrays. 77 * into JavaScript Objects and Arrays.
78 * 78 *
79 * The following expression creats a new JavaScript object with the properties 79 * The following expression creates a new JavaScript object with the properties
80 * `a` and `b` defined: 80 * `a` and `b` defined:
81 * 81 *
82 * var jsMap = new JsObject.jsify({'a': 1, 'b': 2}); 82 * var jsMap = new JsObject.jsify({'a': 1, 'b': 2});
83 * 83 *
84 * This expression creates a JavaScript array: 84 * This expression creates a JavaScript array:
85 * 85 *
86 * var jsArray = new JsObject.jsify([1, 2, 3]); 86 * var jsArray = new JsObject.jsify([1, 2, 3]);
87 */ 87 */
88 library dart.js; 88 library dart.js;
89 89
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1676 } 1676 }
1677 1677
1678 /// Cached JSFunction associated with the Dart function when "this" is 1678 /// Cached JSFunction associated with the Dart function when "this" is
1679 /// captured. 1679 /// captured.
1680 Expando<JSFunction> _interopCaptureThisExpando = new Expando<JSFunction>(); 1680 Expando<JSFunction> _interopCaptureThisExpando = new Expando<JSFunction>();
1681 1681
1682 /// Returns a [Function] that when called from JavaScript captures its 'this' 1682 /// Returns a [Function] that when called from JavaScript captures its 'this'
1683 /// binding and calls [f] with the value of this passed as the first argument. 1683 /// binding and calls [f] with the value of this passed as the first argument.
1684 /// When called from Dart, [null] will be passed as the first argument. 1684 /// When called from Dart, [null] will be passed as the first argument.
1685 /// 1685 ///
1686 /// See the documention for [allowInterop]. This method should only be used with 1686 /// See the documentation for [allowInterop]. This method should only be used
1687 /// package:js Dart-JavaScript interop. 1687 /// with package:js Dart-JavaScript interop.
1688 JSFunction allowInteropCaptureThis(Function f) { 1688 JSFunction allowInteropCaptureThis(Function f) {
1689 if (f is JSFunction) { 1689 if (f is JSFunction) {
1690 // Behavior when the function is already a JS function is unspecified. 1690 // Behavior when the function is already a JS function is unspecified.
1691 throw new ArgumentError( 1691 throw new ArgumentError(
1692 "Function is already a JS function so cannot capture this."); 1692 "Function is already a JS function so cannot capture this.");
1693 return f; 1693 return f;
1694 } else { 1694 } else {
1695 var ret = _interopCaptureThisExpando[f]; 1695 var ret = _interopCaptureThisExpando[f];
1696 if (ret == null) { 1696 if (ret == null) {
1697 // TODO(jacobr): we could optimize this. 1697 // TODO(jacobr): we could optimize this.
1698 ret = JSFunction._createWithThis(f); 1698 ret = JSFunction._createWithThis(f);
1699 _interopCaptureThisExpando[f] = ret; 1699 _interopCaptureThisExpando[f] = ret;
1700 } 1700 }
1701 return ret; 1701 return ret;
1702 } 1702 }
1703 } 1703 }
OLDNEW
« no previous file with comments | « sdk/lib/js/dart2js/js_dart2js.dart ('k') | tests/benchmark_smoke/benchmark_base.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698