JavaScript event queuing

So based on [EventTarget.dispatchEvent()][1] and this [StackOverflow
answer][2], dispatching an event in JavaScript with
`EventTarget.dispatchEvent()` is synchronous. The method even returns
whether the default action was canceled.

This indicates to me that it is not unreasonable for our `xf:dispatch`
action to be synchronous by default (without a delay), although we can make
a case either way.

The way you delay events in JavaScript is by using a `setTimeout()` (or
maybe `Window.postMessage()`), and that explicitly adds the callback/the
message post to a queue.

-Erik

[1]
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent
[2]
https://stackoverflow.com/questions/15277800/is-dispatchevent-a-sync-or-an-async-function

Received on Wednesday, 31 May 2017 05:14:44 UTC