Re: [whatwg/dom] Removing event listeners through an identifier (#208)

Thanks all. It seems like between this and [Twitter replies](https://twitter.com/domenic/status/879023389528272897) we have a pretty significant amount of developer interest, which hopefully helps with the motivation. On some specific points on the API design given in #469:

- The name is `group`, not `class` or `tag`.
- #469 currently accepts any JavaScript value except undefined. But @rniwa's concerns about leaks make sense, and nobody has presented a use case that can't be met by just strings or symbols. So I will work on updating the PR to be restricted to strings and symbols. If we come up with a use case that requires more general values we can always loosen that later, if in balance it overcomes @rniwa's concerns.
  - As an alternative, the event listener could hold a weak reference to the group value. However this is presumably more painful to implement, so without strong motivation let's not go this route.
- "It needs to be possible to add multiple classes": can you add an example of how this would be used? I'm also not sure on the best syntax, compared to the current proposal of `{ group: "string" }`.
- "Listeners need to be removable either with or without a type + class(es).": again, an example would help. In #469 I added both `removeEventListener("type", { group })` and `removeEventListener({ group })`, but I wasn't sure what the motivation was for the former; I just added it because it was very easy to do and fell out naturally from the design.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/208#issuecomment-311168203

Received on Monday, 26 June 2017 20:11:42 UTC