DefaultActionDispatcher

public class DefaultActionDispatcher : ActionDispatcher

The default dispatcher implementation that provides the ability to observe when actions are performed, across sessions.

This will attempt to detect if the caller is on the queue the action expects, and avoid crashing with a DispatchQueue.sync call when already on that queue. If the current queue is not the action’s queue, it will use a DispatchQueue.sync.

The goal is that if the app is on the main queue, call perform and the dispatcher than finds the action expects the main queue, that no queue or async thread hops occur. This prevents a slushy UI that is always updating asynchronously, and means the caller does not have to worry about the queue they are on, and nor does the Action.

However, it is important to not that this mechanism (using setSpecific/getSpecific) will not currently work if the Action’s queue uses a target queue. Trivia: the SmartDispatchQueue