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

Side by Side Diff: third_party/pkg/js/lib/js.dart

Issue 176943008: Update the Angular/DI tests to latest from github. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 * The js.dart library provides simple JavaScript invocation from Dart that 6 * The js.dart library provides simple JavaScript invocation from Dart that
7 * works on both Dartium and on other modern browsers via Dart2JS. 7 * works on both Dartium and on other modern browsers via Dart2JS.
8 * 8 *
9 * It provides a model based on scoped [Proxy] objects. Proxies give Dart 9 * It provides a model based on scoped [Proxy] objects. Proxies give Dart
10 * code access to JavaScript objects, fields, and functions as well as the 10 * code access to JavaScript objects, fields, and functions as well as the
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 * See [samples](http://dart-lang.github.com/js-interop/example) for more 63 * See [samples](http://dart-lang.github.com/js-interop/example) for more
64 * examples of usage. 64 * examples of usage.
65 * 65 *
66 * See this [article](http://www.dartlang.org/articles/js-dart-interop) for 66 * See this [article](http://www.dartlang.org/articles/js-dart-interop) for
67 * more detailed discussion. 67 * more detailed discussion.
68 */ 68 */
69 69
70 library js; 70 library js;
71 71
72 import 'dart:js' as js; 72 import 'dart:js' as js;
73 @MirrorsUsed(symbols: '*')
74 import 'dart:mirrors'; 73 import 'dart:mirrors';
75 74
76 /** 75 /**
77 * A proxy on the global JavaScript context for this page. 76 * A proxy on the global JavaScript context for this page.
78 */ 77 */
79 final Proxy context = new Proxy._(js.context); 78 final Proxy context = new Proxy._(js.context);
80 79
81 /** 80 /**
82 * Check if [proxy] is instance of [type]. 81 * Check if [proxy] is instance of [type].
83 */ 82 */
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 args.map((e) => _deserialize(e)).toList())); 251 args.map((e) => _deserialize(e)).toList()));
253 } 252 }
254 } 253 }
255 254
256 /// A [Proxy] subtype to JavaScript functions. 255 /// A [Proxy] subtype to JavaScript functions.
257 class FunctionProxy extends Proxy<FunctionProxy> implements Function { 256 class FunctionProxy extends Proxy<FunctionProxy> implements Function {
258 final js.JsFunction _jsFunction; 257 final js.JsFunction _jsFunction;
259 final _thisArg; 258 final _thisArg;
260 259
261 FunctionProxy._(js.JsFunction jsFunction, {thisArg}) : 260 FunctionProxy._(js.JsFunction jsFunction, {thisArg}) :
262 this._jsFunction = jsFunction, 261 _jsFunction = jsFunction,
263 this._thisArg = thisArg, 262 _thisArg = thisArg,
264 super._(jsFunction); 263 super._(jsFunction);
265 264
266 factory FunctionProxy(Function f) => new FunctionProxy._( 265 factory FunctionProxy(Function f) => new FunctionProxy._(
267 new js.JsFunction.withThis(new _CallbackFunction(f))); 266 new js.JsFunction.withThis(new _CallbackFunction(f)));
268 267
269 factory FunctionProxy.withThis(Function f) => new FunctionProxy._( 268 factory FunctionProxy.withThis(Function f) => new FunctionProxy._(
270 new js.JsFunction.withThis(new _CallbackFunction(f, withThis: true))); 269 new js.JsFunction.withThis(new _CallbackFunction(f, withThis: true)));
271 270
272 // We need to implement call() to satisfy the Function "interface" 271 // We need to implement call() to satisfy the Function "interface"
273 // This handles the no-arg case, noSuchMethod handles the rest. 272 // This handles the no-arg case, noSuchMethod handles the rest.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 if (o == null) { 318 if (o == null) {
320 return null; 319 return null;
321 } else if (o is js.JsFunction) { 320 } else if (o is js.JsFunction) {
322 return new FunctionProxy._(o, thisArg: thisArg); 321 return new FunctionProxy._(o, thisArg: thisArg);
323 } else if (o is js.JsObject) { 322 } else if (o is js.JsObject) {
324 return new Proxy._(o); 323 return new Proxy._(o);
325 } else { 324 } else {
326 return o; 325 return o;
327 } 326 }
328 } 327 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698