RE: Better event listeners

> Assuming I am not mistaken on how jQuery Deferred and events don't
> interact, I take that as a signal that it might not be something people
> use and probably even need.

I'm not going to enter the debate, but event debouncing has become a pretty important problem nowadays, particularly for sensitive synchronous events like 'onscroll', 'onmousemove' and mutation events.

Could Future(s) help solve this problem in an elegant way? I don't know, but the approach seems,worth investivating.

(approach: create a Future for multiple events that should trigger a relayout, once one of them happen, your handler is queued for execution and removed from the listeners, when your handler is called you have the opportunity to 'reset' the Future to reregister to the events)

The advantage is that you debounce at the same time multiple events, any kind of them (DOM events but also any kind of future-generator). 		 	   		  

Received on Saturday, 16 March 2013 22:37:53 UTC