Skip to content

Commit

Permalink
Move more js_util usage to the dom library (#2121)
Browse files Browse the repository at this point in the history
This was originally written to use `js_util.getProperty` at the calling
side to push the knowledge of the different types of sources into the
usage location. Instead, wrap it up with js interop and use nullability
to reflect that some of the fields may not exist.
  • Loading branch information
natebosch authored Oct 16, 2023
1 parent ba050ae commit 6ac4ff9
Show file tree
Hide file tree
Showing 5 changed files with 931 additions and 904 deletions.
2 changes: 2 additions & 0 deletions pkgs/test/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 1.24.9-wip

## 1.24.8

* Remove spurious deprecation during autocomplete for `setUp` and `tearDown`.
Expand Down
15 changes: 15 additions & 0 deletions pkgs/test/lib/src/runner/browser/dom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,21 @@ extension MessageEventExtension on MessageEvent {
@staticInterop
class MessageEventSource {}

extension MessageEventSourceExtension on MessageEventSource {
@pragma('dart2js:as:trust')
MessageEventSourceLocation? get location =>
js_util.getProperty<dynamic>(this, 'location')
as MessageEventSourceLocation;
}

@JS()
@staticInterop
class MessageEventSourceLocation {}

extension MessageEventSourceLocationExtension on MessageEventSourceLocation {
external String? get href;
}

@JS()
@staticInterop
class Location {}
Expand Down
Loading

0 comments on commit 6ac4ff9

Please sign in to comment.