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

Side by Side Diff: tool/input_sdk/lib/html/html_common/conversions_dart2js.dart

Issue 1700153002: Wrapperless dart:html and friends (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: A couple more tweaks Created 4 years, 10 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
OLDNEW
1 part of html_common; 1 part of html_common;
2 2
3 /// Converts a JavaScript object with properties into a Dart Map. 3 /// Converts a JavaScript object with properties into a Dart Map.
4 /// Not suitable for nested objects. 4 /// Not suitable for nested objects.
5 Map convertNativeToDart_Dictionary(object) { 5 Map convertNativeToDart_Dictionary(object) {
6 if (object == null) return null; 6 if (object == null) return null;
7 var dict = {}; 7 var dict = {};
8 var keys = JS('JSExtendableArray', 'Object.getOwnPropertyNames(#)', object); 8 var keys = JS('JSExtendableArray', 'Object.getOwnPropertyNames(#)', object);
9 for (final key in keys) { 9 for (final key in keys) {
10 dict[key] = JS('var', '#[#]', object, key); 10 dict[key] = JS('var', '#[#]', object, key);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 bool isImmutableJavaScriptArray(value) => 82 bool isImmutableJavaScriptArray(value) =>
83 JS('bool', r'!!(#.immutable$list)', value); 83 JS('bool', r'!!(#.immutable$list)', value);
84 bool isJavaScriptPromise(value) => 84 bool isJavaScriptPromise(value) =>
85 JS('bool', r'typeof Promise != "undefined" && # instanceof Promise', value); 85 JS('bool', r'typeof Promise != "undefined" && # instanceof Promise', value);
86 86
87 Future convertNativePromiseToDartFuture(promise) { 87 Future convertNativePromiseToDartFuture(promise) {
88 var completer = new Completer(); 88 var completer = new Completer();
89 var then = convertDartClosureToJS((result) => completer.complete(result), 1); 89 var then = convertDartClosureToJS((result) => completer.complete(result), 1);
90 var error = convertDartClosureToJS((result) => completer.completeError(result) , 1); 90 var error = convertDartClosureToJS((result) => completer.completeError(result) , 1);
91 var newPromise = JS('', '#.then(#).catch(#)', promise, then, error); 91 var newPromise = JS('', '#.then(#)["catch"](#)', promise, then, error);
92 return completer.future; 92 return completer.future;
93 } 93 }
94 94
95 // TODO(vsm,jacobr): We shouldn't need to expose these.
95 /// Wrap a JS object with an instance of the matching dart:html class. Used only in Dartium. 96 /// Wrap a JS object with an instance of the matching dart:html class. Used only in Dartium.
96 //wrap_jso(jsObject) => jsObject; 97 wrap_jso(jsObject) => jsObject;
97 98
98 /// Find the underlying JS object for a dart:html Dart object. 99 /// Find the underlying JS object for a dart:html Dart object.
99 //unwrap_jso(dartClass_instance) => dartClass_instance; 100 unwrap_jso(dartClass_instance) => dartClass_instance;
OLDNEW
« no previous file with comments | « tool/input_sdk/lib/html/ddc/html_ddc.dart ('k') | tool/input_sdk/lib/html/html_common/device.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698