Closed Bug 709469 Opened 13 years ago Closed 6 years ago

[Gonk] Consider postMessage() instead of setTimeout(..., 0) to dispatch click events

Categories

(Core :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: philikon, Unassigned)

References

Details

Currently touch.js uses setTimeout(..., 0) to ensure click event handlers don't block the click event dispatch. However, there's a delay of a few ms associated with it. gal suggested in bug 708538 to use postMessage instead.

(Note that postMessage can be pretty allocation heavy since it creates new event objects and marshals the data that's transferred.)
Alternately would be use the setImmediate proposed by IE guys.

https://developer.mozilla.org/en/DOM/window.setImmediate

Since these no setImmediate in Gecko, we can use this *and* then shim it. I have code to recycle from that does this.
This is chrome land code, so we really don't wont shims there. postMessage() seems to be the way to go.
What about the schedule API that is proposed in bug 692420?
(In reply to Vivien Nicolas (:vingtetun) from comment #3)
> What about the schedule API that is proposed in bug 692420?

Sure. But touch.js is chrome code, right? Just do

   Services.tm.currentThread.dispatch(func, Ci.nsIThread.DISPATCH_NORMAL);
Closing as we are not working on Firefox OS anymore.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.