I think you're joking, but honestly I really do think event handling could use a better abstraction, the same way promises did for procedural async. I don't really know what it would look like though. Something something streams, something something generators.
I agree. I've never found major issue with callbacks.
IMO, so many of the "problems" with JS are due to the vast majority of people who look at the community and apply fixes/patterns/designs without understand how it actually affects their code.
Don’t call my callback too early
Don’t call my callback too late
Don’t call my callback too few times
Don’t call my callback too many times
Make sure to provide my callback with any necessary state/parameters
Make sure to notify me if my callback fails in some way
Oh my god, these apply to every function call in my application! Promises are the hammers to all the nails!
It's true for callbacks; I think Promises have replaced them and soon we will have async/await which should ease working with them... So, almost there.
Concerning events, Observables are replacing event listeners. Most frameworks have settles on an observable library, and there will be soon be a standard Observable set of interfaces... hopefully. But we are not there yet and it's still very unstable. We even get new observable libraries popping up.
29
u/[deleted] Jul 10 '16
Callbacks obsolete? Seems premature to say so.