Skip to content

Commit 4fac869

Browse files
committed
Explicitly call out legacy JS interop as deprecated
1 parent 20b8c31 commit 4fac869

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

src/content/interop/js-interop/package-web.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ by addressing several concerns with the existing Dart web libraries:
3737
if they use [`dart:js_interop`][] and [`dart:js_interop_unsafe`][].
3838
`package:web` is based on `dart:js_interop`,
3939
so by default, it's supported on `dart2wasm`.
40-
40+
4141
Dart core web libraries, like [`dart:html`][html] and [`dart:svg`][svg],
42-
are **not supported** when compiling to Wasm.
42+
are deprecated and **not supported** when compiling to Wasm.
4343

4444
2. **Staying modern**
45-
45+
4646
`package:web` uses the [Web IDL][idl] to automatically generate
4747
[interop members][] and [interop types][]
4848
for each declaration in the IDL.

src/content/interop/js-interop/past-js-interop.md

+14-17
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
---
22
title: Past JS interop
3-
description: Archive of past JS interop implementations.
3+
description: Archive of Dart's previous JS interop support.
44
---
55

66
:::warning
77
None of these legacy interop libraries are supported when compiling to [Wasm][].
88
:::
99

10-
This page addresses previous iterations of JS interop for Dart that are
11-
considered legacy. They are not deprecated yet, but will likely be in the
12-
future. Therefore, prefer using [`dart:js_interop`] going forwards and migrate
13-
usages of old interop libraries when possible. While [`dart:html`] and other web
14-
libraries are closely related, they're covered in the [`package:web`] page.
10+
This page addresses previous iterations of JS interop for Dart that
11+
have been considered legacy and are deprecated as of Dart 3.7.
12+
Therefore, prefer using [`dart:js_interop`][] going forwards and
13+
migrate usages of old interop libraries when possible.
14+
While [`dart:html`][] and other web libraries are closely related,
15+
they're covered in the [`package:web`][] page.
16+
17+
[`dart:js_interop`]: {{site.dart-api}}/dart-js_interop/dart-js_interop-library.html
18+
[`dart:html`]: {{site.dart-api}}/dart-html/dart-html-library.html
19+
[`package:web`]: /interop/js-interop/package-web
1520

1621
## `dart:js`
1722

@@ -23,8 +28,8 @@ code-completion as you couldn't declare interop members and instead relied on
2328
Strings. Many of the functionalities exposed in `dart:js` like [`allowInterop`]
2429
were later re-exposed through other interop libraries.
2530

26-
This library has been legacy ever since `package:js` and `dart:js_util` were
27-
released. It will likely be the first to be deprecated.
31+
This library has been legacy since
32+
`package:js` and `dart:js_util` were released.
2833

2934
## `package:js`
3035

@@ -50,7 +55,7 @@ There are significant differences, however:
5055
`package:js` type to `dynamic` and called an interop member on it, it would
5156
forward to the right member. This is no longer possible with
5257
`dart:js_interop`.
53-
- `package:js`' [`@JS`] has no soundness guarantees as return types of
58+
- `package:js`' `@JS` has no soundness guarantees as return types of
5459
`external` members were not checked. `dart:js_interop` is sound.
5560
- `package:js` types could not rename instance members or have non-`external`
5661
members.
@@ -101,20 +106,12 @@ and forth. This included members like:
101106
`dart:js_interop` and `dart:js_interop_unsafe` contain these helpers now with
102107
possibly alternate syntax.
103108

104-
{% comment %}
105-
TODO: add links (with stable) when ready:
106-
TODO: Link to `package:web` section
107-
{% endcomment %}
108109

109-
[`dart:js_interop`]: {{site.dart-api}}/dart-js_interop/dart-js_interop-library.html
110-
[`dart:html`]: {{site.dart-api}}/dart-html/dart-html-library.html
111-
[`package:web`]: /interop/js-interop/package-web
112110
[`dart:js`]: {{site.dart-api}}/dart-js/dart-js-library.html
113111
[`object wrapper`]: {{site.dart-api}}/dart-js/JsObject-class.html
114112
[`allowInterop`]: {{site.dart-api}}/dart-js_util/allowInterop.html
115113
[`package:js`]: {{site.pub-pkg}}/js
116114
[`JSObject`]: {{site.dart-api}}/dart-js_interop/JSObject-extension-type.html
117-
[`@JS`]: {{site.repo.dart.sdk}}/blob/main/sdk/lib/js/_js_annotations.dart#L11
118115
[tutorial on mocking]: /interop/js-interop/mock
119116
[`@anonymous`]: {{site.repo.dart.sdk}}/blob/main/sdk/lib/js/_js_annotations.dart#L40
120117
[`@staticInterop`]: {{site.repo.dart.sdk}}/blob/main/sdk/lib/js/_js_annotations.dart#L48

0 commit comments

Comments
 (0)