Skip to content
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

Pass event objects to event handlers, please #170

Closed
gka opened this issue Mar 1, 2018 · 1 comment
Closed

Pass event objects to event handlers, please #170

gka opened this issue Mar 1, 2018 · 1 comment

Comments

@gka
Copy link

gka commented Mar 1, 2018

The d3.event + ES6 bundler nightmare is no fun to work around.

If you use Babel, Webpack, or another ES6-to-ES5 bundler, be aware that the value of d3.event changes during an event! An import of d3.event must be a live binding, so you may need to configure the bundler to import from D3’s ES6 modules rather than from the generated UMD bundle; not all bundlers observe jsnext:main.

I'd say it's one of the most basic assumptions in event driven programming that the event handler somehow gets the event object passed as argument. I don't care if it's the first or tenth argument, but please don't rely on any global d3.event or window.event sorcery.

@mbostock
Copy link
Member

mbostock commented Mar 1, 2018

This would break everything, so I’m not going to do this for D3 5.0. I might consider it for a future major release.

@mbostock mbostock closed this as completed Mar 1, 2018
@quentindemetz quentindemetz mentioned this issue Sep 30, 2018
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants