W3C home > Mailing lists > Public > www-style@w3.org > July 2013

[css-regions] Async events, events coalescing, magic stuffs

From: François REMY <francois.remy.dev@outlook.com>
Date: Tue, 30 Jul 2013 23:24:11 +0200
Message-ID: <DUB120-W2214AB6BE0781D7C3F02BBA5560@phx.gbl>
To: "www-style@w3.org" <www-style@w3.org>
This one is funny:

Suppose I'm a layout manager which use regions. I want to know when the layout of my regions is updated because I want to post-process the result.

My pattern would be:

- mark my stuff as invalidated
- stop listening to region events
- queue a microtask for recomputation:
--- get the current region layout properties I need
--- do my stuff, which will possibly trigger one of more region relayout
--- force the layout to happen by doing something fancy like asking for an offsetHeight
--- at this point, everything is done, so...
--- add new event listeners to the region events to cover next updates

In the [css-regions] spec, it's being written that region events are async. Async in which way?

The question is: 

- Will the event listeners I added at the end of my process get possibly notified for the changes that did happen before they were set up? because if they do, I just created an infinite loop... if not, is there any way I can know for sure the event I get does not only cover stuff that happened before I started listening? timestamps maybe?




Another question:

- If I update the layout of my region 10 times, should I expect 10 events or may the events be coalesced to just one if they fire after the 10 relayouts? 		 	   		  
Received on Tuesday, 30 July 2013 21:24:38 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 30 July 2013 21:24:39 UTC