|
| 1 | +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 | + |
| 5 | +// This library is only supported on dart2wasm because of [allowInterop]. |
| 6 | + |
| 7 | +library dart.js; |
| 8 | + |
| 9 | +import 'dart:_internal' show patch; |
| 10 | +import 'dart:_js_helper'; |
| 11 | +import 'dart:collection' show ListMixin; |
| 12 | +import 'dart:wasm'; |
| 13 | + |
| 14 | +@patch |
| 15 | +JsObject get context => throw UnimplementedError; |
| 16 | + |
| 17 | +@patch |
| 18 | +class JsObject { |
| 19 | + // No argument empty constructor to support inheritance. |
| 20 | + JsObject._() { |
| 21 | + throw UnimplementedError; |
| 22 | + } |
| 23 | + |
| 24 | + @patch |
| 25 | + factory JsObject(JsFunction constructor, [List? arguments]) => |
| 26 | + throw UnimplementedError; |
| 27 | + |
| 28 | + @patch |
| 29 | + factory JsObject.fromBrowserObject(Object object) => throw UnimplementedError; |
| 30 | + |
| 31 | + @patch |
| 32 | + factory JsObject.jsify(Object object) => throw UnimplementedError; |
| 33 | + |
| 34 | + @patch |
| 35 | + dynamic operator [](Object property) => throw UnimplementedError; |
| 36 | + |
| 37 | + @patch |
| 38 | + void operator []=(Object property, Object? value) => throw UnimplementedError; |
| 39 | + |
| 40 | + @patch |
| 41 | + bool operator ==(Object other) => throw UnimplementedError; |
| 42 | + |
| 43 | + @patch |
| 44 | + bool hasProperty(Object property) => throw UnimplementedError; |
| 45 | + |
| 46 | + @patch |
| 47 | + void deleteProperty(Object property) => throw UnimplementedError; |
| 48 | + |
| 49 | + @patch |
| 50 | + bool instanceof(JsFunction type) => throw UnimplementedError; |
| 51 | + |
| 52 | + @patch |
| 53 | + String toString() => throw UnimplementedError; |
| 54 | + |
| 55 | + @patch |
| 56 | + dynamic callMethod(Object method, [List? args]) => throw UnimplementedError; |
| 57 | +} |
| 58 | + |
| 59 | +@patch |
| 60 | +class JsFunction extends JsObject { |
| 61 | + @patch |
| 62 | + factory JsFunction.withThis(Function f) => throw UnimplementedError; |
| 63 | + |
| 64 | + @patch |
| 65 | + dynamic apply(List args, {thisArg}) => throw UnimplementedError; |
| 66 | +} |
| 67 | + |
| 68 | +@patch |
| 69 | +class JsArray<E> extends JsObject with ListMixin<E> { |
| 70 | + @patch |
| 71 | + factory JsArray() => throw UnimplementedError; |
| 72 | + |
| 73 | + @patch |
| 74 | + factory JsArray.from(Iterable<E> other) => throw UnimplementedError; |
| 75 | + |
| 76 | + @patch |
| 77 | + E operator [](Object index) => throw UnimplementedError; |
| 78 | + |
| 79 | + @patch |
| 80 | + void operator []=(Object index, E value) => throw UnimplementedError; |
| 81 | + |
| 82 | + @patch |
| 83 | + int get length => throw UnimplementedError; |
| 84 | + |
| 85 | + @patch |
| 86 | + void set length(int length) => throw UnimplementedError; |
| 87 | + |
| 88 | + @patch |
| 89 | + void add(E value) => throw UnimplementedError; |
| 90 | + |
| 91 | + @patch |
| 92 | + void addAll(Iterable<E> iterable) => throw UnimplementedError; |
| 93 | + |
| 94 | + @patch |
| 95 | + void insert(int index, E element) => throw UnimplementedError; |
| 96 | + |
| 97 | + @patch |
| 98 | + E removeAt(int index) => throw UnimplementedError; |
| 99 | + |
| 100 | + @patch |
| 101 | + E removeLast() => throw UnimplementedError; |
| 102 | + |
| 103 | + @patch |
| 104 | + void removeRange(int start, int end) => throw UnimplementedError; |
| 105 | + |
| 106 | + @patch |
| 107 | + void setRange(int start, int end, Iterable<E> iterable, |
| 108 | + [int skipCount = 0]) => |
| 109 | + throw UnimplementedError; |
| 110 | + |
| 111 | + @patch |
| 112 | + void sort([int compare(E a, E b)?]) => throw UnimplementedError; |
| 113 | +} |
| 114 | + |
| 115 | +/// This will be lowered to a a call to `_wrapDartCallback`. |
| 116 | +@patch |
| 117 | +F allowInterop<F extends Function>(F f) => throw UnimplementedError; |
| 118 | + |
| 119 | +@patch |
| 120 | +Function allowInteropCaptureThis(Function f) => throw UnimplementedError; |
0 commit comments