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"]); |
(...skipping 26 matching lines...) Expand all Loading... |
37 bool isJavaScriptArray(value) => value is js.JsArray; | 37 bool isJavaScriptArray(value) => value is js.JsArray; |
38 | 38 |
39 final _object = js.context["Object"]; | 39 final _object = js.context["Object"]; |
40 final _getPrototypeOf = _object["getPrototypeOf"]; | 40 final _getPrototypeOf = _object["getPrototypeOf"]; |
41 _getProto(object) { | 41 _getProto(object) { |
42 return _getPrototypeOf.apply([object]); | 42 return _getPrototypeOf.apply([object]); |
43 } | 43 } |
44 final _objectProto = js.context["Object"]["prototype"]; | 44 final _objectProto = js.context["Object"]["prototype"]; |
45 | 45 |
46 bool isJavaScriptSimpleObject(value) { | 46 bool isJavaScriptSimpleObject(value) { |
47 if (!value is js.JsObject) return false; | 47 if (value is! js.JsObject) return false; |
48 var proto = _getProto(value); | 48 var proto = _getProto(value); |
49 return proto == _objectProto || proto == null; | 49 return proto == _objectProto || proto == null; |
50 } | 50 } |
51 bool isImmutableJavaScriptArray(value) => | 51 bool isImmutableJavaScriptArray(value) => |
52 isJavaScriptArray(value) && value["immutable$list"] != null; | 52 isJavaScriptArray(value) && value["immutable$list"] != null; |
53 | 53 |
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 |