Skip to content

EventListenerList should be parameterized by the event type #3021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
justinfagnani opened this issue May 12, 2012 · 9 comments
Closed

EventListenerList should be parameterized by the event type #3021

justinfagnani opened this issue May 12, 2012 · 9 comments
Assignees
Labels
type-enhancement A request for a change that isn't a bug web-libraries Issues impacting dart:html, etc., libraries
Milestone

Comments

@justinfagnani
Copy link
Contributor

Currently classes that use Events subclasses and EventListenerList don't offer enough assistance in the Dart editor.

For example, Element.on.click takes a function that takes a MouseEvent, but that's not specified in the ElementEvents interface.

The interfaces could be defined like this:

interface EventListenerList<E> { // In Java I'd write <E extends Event>, unsure what to do in Dart
  add(void handler(E event), [bool useCapture];
  ...
}

interface ElementEvents extends Events {
  ...
  EventListenerList<MouseEvent> get on();
  ...
}

Then the editor could check that the handler was of the correct type.

@justinfagnani
Copy link
Contributor Author

Oops, I totally messed up on the ElementEvents interface. on() should be click().

@sethladd
Copy link
Contributor

Removed Type-Defect label.
Added Type-Enhancement, Area-DOM, Triaged labels.

@iposva-google
Copy link
Contributor

Removed Area-DOM label.
Added Area-HTML label.

@rakudrama
Copy link
Member

We don't have a source of information for doing this automatically - the correspondence is not in the IDL.
We could do it manually.
I'm not sure that the types are 100% reliable - you could dispatchEvent an event of the wrong type and in JavaScript, at least, it would probably work just fine.

We will revisit after M1


Added this to the Later milestone.

@blois
Copy link

blois commented Oct 15, 2012

Removed this from the Later milestone.
Added this to the M2 milestone.

@blois
Copy link

blois commented Nov 20, 2012

Added events label.

@blois
Copy link

blois commented Nov 30, 2012

Set owner to @blois.
Added Accepted label.

@blois
Copy link

blois commented Dec 3, 2012

Removed this from the M2 milestone.
Added this to the M3 milestone.

@blois
Copy link

blois commented Jan 24, 2013

New DOM event streams are now parameterized.


Added Fixed label.

@justinfagnani justinfagnani added Type-Enhancement web-libraries Issues impacting dart:html, etc., libraries labels Jan 24, 2013
@justinfagnani justinfagnani added this to the M3 milestone Jan 24, 2013
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
dart-bot pushed a commit that referenced this issue Jun 4, 2021
New commits include:
```
git log --format="%C(auto) %h %s" 11c2a0978e66fbc2c182dc6a8174db1a3651276c..3c14d86a67db7207bbc9f654ac49ee60e08e5240
 3c14d86a Test cases with core.ignoreCase = true / false (#3025)
 937cd3be Fix CR LF in .gitignore / .pubignore (#3026)
 610254f7 Add test to ignore dot-files (#2983)
 c24d7478 Fixes linter warnings (#3021)
```

Change-Id: I49f0fc3a2360b0e1e4e009a4fff2a702163cd6b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202481
Auto-Submit: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
copybara-service bot pushed a commit that referenced this issue May 20, 2022
…25 revisions)

https://dart.googlesource.com/dartdoc/+log/334072b0cad4..cf0685a2d1ce

2022-05-19 103135467+sealesj@users.noreply.github.com Create scorecards-analysis.yml (#3032)
2022-05-18 srawlins@google.com Add the docs.dart.js.map file to published package (#3042)
2022-05-17 parlough@gmail.com Reintroduce query param search (#3026)
2022-05-17 srawlins@google.com Include docs.dart.js in published code (#3040)
2022-05-17 parlough@gmail.com Optimize built js (#3028)
2022-05-17 srawlins@google.com Use dart run instead of deprecated dart pub run (#3038)
2022-05-17 timmaffett@gmail.com fix exception for empty dartdoc_options.yaml file (#3034)
2022-05-16 oss@simonbinder.eu Fix build config (#3035)
2022-05-02 goderbauer@google.com Drop version back to 5.1.0 (#3031)
2022-05-02 goderbauer@google.com Fixed: YouTube directive respects width/height argument (#3030)
2022-04-19 devoncarew@gmail.com Update pubspec.yaml (#3025)
2022-04-12 srawlins@google.com Remove dead field commentRefs, which is always empty (#3021)
2022-04-12 devoncarew@gmail.com make the converted web frontend follow Dart conventions (#3020)
2022-04-11 devoncarew@gmail.com convert lib/resources/script.js to Dart (#3016)
2022-04-11 49699333+dependabot[bot]@users.noreply.github.com Bump actions/cache from 3.0.1 to 3.0.2 (#3019)
2022-04-10 devoncarew@gmail.com rename the CI script (#3017)
2022-04-08 49699333+dependabot[bot]@users.noreply.github.com Bump actions/cache from 2 to 3.0.1 (#3014)
2022-04-08 49699333+dependabot[bot]@users.noreply.github.com Bump markdown from 4.0.1 to 5.0.0 (#3015)
2022-04-08 srawlins@google.com Move many static declarations to top-level; avoid RegExp (#3009)
2022-04-08 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 2 to 3 (#3013)
2022-04-07 devoncarew@gmail.com Add a web frontend (#3011)
2022-04-07 devoncarew@gmail.com enable dependabot deps checks (#3012)
2022-04-07 srawlins@google.com Do not store the AstNode on ModelNode; eagerly grab the source indexes (#3008)
2022-04-07 srawlins@google.com Create a .pubignore in order to skip testing files from publish check (#3010)
2022-03-29 srawlins@google.com Bump to version 5.1.0 (#3006)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/dart-doc-dart-sdk
Please CC dart-ecosystem-gardener@grotations.appspotmail.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Dart Documentation Generator: https://github.com/dart-lang/dartdoc/issues
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Tbr: dart-ecosystem-gardener@grotations.appspotmail.com
Change-Id: I3467a27d6947c43f7f41acbb2959d72863fd8a34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245483
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug web-libraries Issues impacting dart:html, etc., libraries
Projects
None yet
Development

No branches or pull requests

6 participants