W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2013

RE: Better event listeners

From: François REMY <francois.remy.dev@outlook.com>
Date: Sat, 16 Mar 2013 23:37:26 +0100
Message-ID: <DUB002-W52054AAA941F392D184BC5A5EE0@phx.gbl>
To: David Bruant <bruant.d@gmail.com>, Jonas Sicking <jonas@sicking.cc>, Rick Waldron <waldron.rick@gmail.com>
CC: Anne van Kesteren <annevk@annevk.nl>, "www-dom@w3.org" <www-dom@w3.org>, Yehuda Katz <wycats@gmail.com>
> 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

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:20 UTC