OLD | NEW |
1 part of html_common; | 1 part of html_common; |
2 | 2 |
3 convertDartToNative_PrepareForStructuredClone(value) => | 3 convertDartToNative_PrepareForStructuredClone(value) => |
4 new _StructuredCloneDartium().convertDartToNative_PrepareForStructuredClone(
value); | 4 new _StructuredCloneDartium().convertDartToNative_PrepareForStructuredClone(
value); |
5 | 5 |
6 convertNativeToDart_AcceptStructuredClone(object, {mustCopy: false}) => | 6 convertNativeToDart_AcceptStructuredClone(object, {mustCopy: false}) => |
7 new _AcceptStructuredCloneDartium().convertNativeToDart_AcceptStructuredClon
e(object, mustCopy: mustCopy); | 7 new _AcceptStructuredCloneDartium().convertNativeToDart_AcceptStructuredClon
e(object, mustCopy: mustCopy); |
8 | 8 |
9 class _StructuredCloneDartium extends _StructuredClone { | 9 class _StructuredCloneDartium extends _StructuredClone { |
10 newJsMap() => new js.JsObject(js.context["Object"]); | 10 newJsMap() => new js.JsObject(js.context["Object"]); |
11 putIntoMap(map, key, value) => map[key] = value; | 11 putIntoMap(map, key, value) => map[key] = value; |
12 newJSList(length) => new js.JsArray(); | 12 newJsList(length) => new js.JsArray(); |
13 cloneNotRequired(e) => e is js.JsObject; | 13 cloneNotRequired(e) => e is js.JsObject; |
14 } | 14 } |
15 | 15 |
16 class _AcceptStructuredCloneDartium extends _AcceptStructuredClone { | 16 class _AcceptStructuredCloneDartium extends _AcceptStructuredClone { |
17 newDartList(length) => new List(length); | 17 newDartList(length) => new List(length); |
18 | 18 |
19 // JsObjects won't be identical, but will be equal only if the underlying | 19 // JsObjects won't be identical, but will be equal only if the underlying |
20 // Js entities are identical. | 20 // Js entities are identical. |
21 bool identicalInJs(a, b) => | 21 bool identicalInJs(a, b) => |
22 (a is js.JsObject) ? a == b : identical(a, b); | 22 (a is js.JsObject) ? a == b : identical(a, b); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 final _promiseConstructor = js.context['Promise']; | 54 final _promiseConstructor = js.context['Promise']; |
55 bool isJavaScriptPromise(value) => value is js.JsObject && value['constructor']
== _promiseConstructor; | 55 bool isJavaScriptPromise(value) => value is js.JsObject && value['constructor']
== _promiseConstructor; |
56 | 56 |
57 Future convertNativePromiseToDartFuture(js.JsObject promise) { | 57 Future convertNativePromiseToDartFuture(js.JsObject promise) { |
58 var completer = new Completer(); | 58 var completer = new Completer(); |
59 var newPromise = promise | 59 var newPromise = promise |
60 .callMethod("then", [(result) => completer.complete(result)]) | 60 .callMethod("then", [(result) => completer.complete(result)]) |
61 .callMethod("catch", [(result) => completer.completeError(result)]); | 61 .callMethod("catch", [(result) => completer.completeError(result)]); |
62 return completer.future; | 62 return completer.future; |
63 } | 63 } |
OLD | NEW |