cash
cash copied to clipboard
Passive listeners
Feature description
I want to add passive behavior to my touchstart event listener which I have initialized through the $().on("touchstart", function)
command. This is how we add passive event listeners in chrome https://stackoverflow.com/questions/37721782/what-are-passive-event-listeners
Feature motivation
This boosts performance in chrome considerably.
It's a good idea, but we are trying to be a jQuery alternative and jQuery doesn't (yet) have this functionality, so I think it would be better to wait until jQuery v4 is out, which I think should add support for this, and align with that.
I we are trying to be an alternative, then why not be a better one?
https://github.com/jquery/jquery/issues/2871
"Alternative" might not have been the best word to describe Cash, it is (for the most part) a subset of jQuery, that means people can attempt to switch to it and from it pretty easily, that also means we don't have to write a proper thorough documentation and we can just point at jQuery's.
We could however still maintain those benefits by implementing this in a backwards-compatible manner and mentioning the difference with jQuery in the migration guide. I want however to keep our implementation aligned with jQuery's, but they don't have one yet. Most probably they will implement it differently which means eventually we'll have to publish a new major release.
Nothing insurmountable though, if anybody has a proposal about how to implement this I'm all ears.
Well, since jQuery is currently 60% of the way towards version 4 (https://github.com/jquery/jquery/milestone/7) we might as well wait for the syntax.
A very decent way to add support for this could be a accepting an options
object after the data object, that'd be backwards compatible and pretty clean.
jQuery can't do that because they accept multiple data arguments, I'm not sure why.