I wouldn’t recommend using the command registry to listen for native events. It’s designed for commands that you intend to show up in the command palette. That doesn’t really make sense for things like “click”.
Also, the command registry uses the
useCapture option of
addEventListener to register event handlers. This means that handlers registered via the command registry will always be executed before handlers registered directly via DOM APIs. For commands this is fine, because everyone should be using the command registry to listen for commands anyway. Using the command registry for other kinds of events could lead to surprise when listeners registered via the command handler don’t interleave with native handlers during event bubbling.
I worked on a solution to this problem but it involved pretty severe intervention in the browser’s native event cascade mechanism, and it didn’t seem like a good use of time. Someday, we may be able to offer an
atom.events mechanism that works consistently for both commands and events. Maybe. But for now I think we should stick to native handling mechanisms for standard events. I’d honestly consider enforcing this with an explicit black list once jQuery is gone.