Raising a concern about `addEventListener` and its context probably made me
think it was rather a WHATWG concern.
Anyway, I don't know why you had to point out the `class` keyword ... I
mean ....
```js
class SomeClass {
constructor(someNode) {
someNode.addEventListener('click', this);
},
onclick(e) {
alert(this.constructor.name); // SomeClass
},
handleEvent(e) {
this['on' + e.type](e);
}
}
```
There you go
Best Regards
On Mon, May 9, 2016 at 2:28 PM, Mark Kennedy <[email protected]> wrote:
> Wow that's so ironic because [I posted this same idea](
> https://github.com/whatwg/dom/issues/245#issuecomment-217816301)
> (literally copied and pasted) in WHATWG's "DOM land" and they told me this
> was an es-discuss issue. So which is it?
> Oh and thanks for the code sample but it uses the old prototypical method
> of replicating a class by creating a function which is now not the most
> efficient way (there's the `class` keyword). And I don't see how what
> you're doing isn't any different from a roundabout way of what I did. I
> already know about the `handleEvent()` stuff, I like that it's available
> and its polyfills. They are great, but my original question is to implement
> sugar so that you don't have to use polyfills or the `handleEvent()`.
>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss