hotwired / stimulus

A modest JavaScript framework for the HTML you already have
https://stimulus.hotwired.dev/
MIT License
12.67k stars 420 forks source link

EventListenerObject location? #91

Closed nhrones closed 6 years ago

nhrones commented 6 years ago

Where in Action.ts ... export class Action implements EventListenerObject It is unclear where this interface is declared. it is not imported in the class file?

javan commented 6 years ago

That's a lesser-known part of the standard DOM interface so it's provided automatically by TypeScript. Here's a great introduction: https://medium.com/@WebReflection/dom-handleevent-a-cross-platform-standard-since-year-2000-5bf17287fd38

javan commented 6 years ago

For any future readers, here's the implementation: https://github.com/stimulusjs/stimulus/blob/4db9f6b3e7900686fd3d03c0997dea3b8ce5fa05/packages/%40stimulus/core/src/action.ts#L6 https://github.com/stimulusjs/stimulus/blob/4db9f6b3e7900686fd3d03c0997dea3b8ce5fa05/packages/%40stimulus/core/src/action.ts#L29-L33

h/t @WebReflection

nhrones commented 6 years ago

Thanks for this. Great to know.

On Fri, Feb 2, 2018 at 7:22 AM, Javan Makhmali notifications@github.com wrote:

For any future readers, here's the implementation: https://github.com/stimulusjs/stimulus/blob/4db9f6b3e7900686fd3d03c0997dea 3b8ce5fa05/packages/%40stimulus/core/src/action.ts#L6 https://github.com/stimulusjs/stimulus/blob/4db9f6b3e7900686fd3d03c0997dea 3b8ce5fa05/packages/%40stimulus/core/src/action.ts#L29-L33

h/t @WebReflection https://github.com/webreflection

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stimulusjs/stimulus/issues/91#issuecomment-362572284, or mute the thread https://github.com/notifications/unsubscribe-auth/ADIHwzBSheKPSm1jvianczxWSVfIhhCkks5tQv3-gaJpZM4R2yiv .