You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Occasionally I'd like to do something like "execute on the main queue, but as .immediate if that would run on the main queue". This is fairly esoteric, but I want it for scenarios like
The rationale here is if my client then attaches an .immediate listener and that ends up running on the main thread, I need my own work to have been completed first. In the then case I can work around this by using .immediate and dispatching to the main queue myself if I'm not on the main thread, but that won't work for the map case.
I'm not sold on the .mainImmediate name.
The text was updated successfully, but these errors were encountered:
I have another use-case: Fetching an image and assigning it to a button. The idea is to assign it immediately if the result is already available, otherwise to assign it on .main (the fact that it would run as .immediate if it asynchronously resolves on .main is unnecessary but harmless). Something like
In many cases, deferring this to .main would still run before the transaction closes, unless we're calling this from within a block dispatched to the main queue already. This edge case is why we'd want to be able to run it .immediate instead if the promise has already resolved.
Occasionally I'd like to do something like "execute on the main queue, but as
.immediate
if that would run on the main queue". This is fairly esoteric, but I want it for scenarios likeThe rationale here is if my client then attaches an
.immediate
listener and that ends up running on the main thread, I need my own work to have been completed first. In thethen
case I can work around this by using.immediate
and dispatching to the main queue myself if I'm not on the main thread, but that won't work for themap
case.I'm not sold on the
.mainImmediate
name.The text was updated successfully, but these errors were encountered: