Skip to content

Commit

Permalink
fixes to the return types of several Node helper extension methods (#121
Browse files Browse the repository at this point in the history
)

* fixes to the return types of several Node helper extension methods

* update changelog

* Update lib/src/helpers/extensions.dart

* deprecated two helper extension methods
  • Loading branch information
devoncarew authored Dec 7, 2023
1 parent 9d7b33e commit acf0beb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
- Exported the helper libraries from `web.dart`.
- Deprecated the `helpers.dart` library in favor of `web.dart`.
- Updated the readme to include usage info and package status.
- Add an example.
- `src/helpers.dart`:
- Added event extensions for `WebSocket`
- Added an example.
- Added event extensions for `WebSocket`
- Fixes to the return types of the `append()` and `clone()` extension methods on
`Node`.
- Deprecated `NodeGlue.append` in favor of `Node.appendChild`.
- Deprecated `NodeGlue.clone` in favor of `Node.cloneNode`.

## 0.4.0

Expand Down
1 change: 1 addition & 0 deletions lib/src/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/// to have from `dart:html`.
///
/// This helper layer serves two purposes:
///
/// * provide useful functionality in environments where `dart:html` is not
/// available (like on Wasm).
/// * help bridge the gap in functionality from the past, which may reduce
Expand Down
7 changes: 5 additions & 2 deletions lib/src/helpers/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
///
/// The extensions here are added by hand over time, depending on needs and use
/// cases. They currently consist of:
///
/// * renames: methods that provide the same functionality, but use a more
/// idiomatic Dart name. Typically these renames match the names used in
/// `dart:html` in the past.
Expand Down Expand Up @@ -66,8 +67,10 @@ extension CanvasRenderingContext2DGlue on CanvasRenderingContext2D {

extension NodeGlue on Node {
set text(String s) => textContent = s;
void append(Node other) => appendChild(other);
void clone(bool deep) => cloneNode(deep);
@Deprecated('See Node.appendChild()')
Node append(Node other) => appendChild(other);
@Deprecated('See Node.cloneNode()')
Node clone(bool? deep) => cloneNode(deep ?? false);
}

extension EventGlue on MouseEvent {
Expand Down

0 comments on commit acf0beb

Please sign in to comment.