Skip to content

Commit

Permalink
[dart:js/js_util] Deprecate dart:js and dart:js_util
Browse files Browse the repository at this point in the history
#59716

Deprecate these in favor of dart:js_interop. Modifies code
samples to account for the deprecated imports.

CoreLibraryReviewExempt: JS-specific library, deprecation only.
Change-Id: I9f01cd203212aaeca08aa1c5a4000b67f54756b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401046
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
  • Loading branch information
srujzs committed Dec 20, 2024
1 parent f3b6370 commit 505f353
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,16 @@ AOT snapshot can be used as follows to run DDC <dart-sdk>/bin/dartaotruntime
Users should migrate to using `dart:js_interop` and `package:web`. See
[#59716][].

#### `dart:js`

- `dart:js` is marked deprecated and will be removed in an upcoming release.
Users should migrate to using `dart:js_interop`. See [#59716][].

#### `dart:js_util`

- `dart:js_util` is marked deprecated and will be removed in an upcoming
release. Users should migrate to using `dart:js_interop`. See [#59716][].

[#59716]: https://github.com/dart-lang/sdk/issues/59716

## 3.6.0
Expand Down
1 change: 1 addition & 0 deletions sdk/lib/js/js.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
/// var jsArray = JsObject.jsify([1, 2, 3]);
///
/// {@category Web (Legacy)}
@Deprecated('Use dart:js_interop instead.')
library dart.js;

import 'dart:collection' show ListMixin;
Expand Down
12 changes: 11 additions & 1 deletion sdk/lib/js_util/js_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/// with `@JS()` annotations.
///
/// {@category Web (Legacy)}
@Deprecated('Use dart:js_interop instead.')
library dart.js_util;

// Examples can assume:
Expand Down Expand Up @@ -148,7 +149,16 @@ class NullRejectionException implements Exception {

/// Converts a JavaScript Promise to a Dart [Future].
///
/// ```dart template:top
/// ```dart
/// // ignore: deprecated_member_use_from_same_package
/// import 'dart:js_util';
///
/// // ignore: deprecated_member_use_from_same_package
/// import 'package:js/js.dart';
///
/// @JS()
/// class Promise<T> {}
///
/// @JS()
/// external Promise<num> get threePromise; // Resolves to 3
///
Expand Down

0 comments on commit 505f353

Please sign in to comment.