[AC-2888] [ios] event queue and postlayout event.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-08-06T10:43:46.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | addeventlistener, event, postlayout |
Reporter | Martin Guillon |
Assignee | Varun Joshi |
Created | 2012-07-23T23:44:29.000+0000 |
Updated | 2016-03-08T07:47:51.000+0000 |
Description
I found a potentially big problem with the event queue.
My application uses a lot of animations and a few of my views listen for 'postlayout' events (because they need to layout upon size change).
as all events are queued in the same context, you especially get 'postlayout' events and buttons 'click' events in the same queue.
In my case i was showing a view with something like 10 views animating (slidein, slideout), this triggered something like 2000 'postlayout' events.
Then just after that if the user triggered a button, it took about 1.5 sec for that event to be processed. Why? because there was 2000 events to process first (event if the associated js callback did nothing).
If i stop listening for "postlayout" events, then everything goes smoothly.
I think something needs to be done about this, i dont think 'postlayout' events should, in any case, slow down the process of other events.
May be we could use different event thread, or may be we could reduce the number of 'postlayout' events (dividing into 'resize', opacity, ....)
What do you think?
I am willing to work on this one , but i need help figuring out the best solution. Especially because i still know very very little about kroll bridge context ....
My problem is not with when 'postlayout' event are fired, but on which thread. But you are right, if less 'postlayout' events would be fired, it would be better. But i still think it s another problem
It s a hundred times better, and i really mean a hundred time!. Now i never get more than 50 events in the queue, even with all my animations. So i guess it solves my issue, but isnt it just a temporary fix? I mean buttons event should have priority over other events such as postlayout events. That bug is gonna come back. For example i am working on a motion module to get gyroscope ...It can fire events at 100Hz so i am almost sure it will come back ;) But for now i am good, so i guess this one can be closed
Closing this issue.