Evaluate an expression in an async phase. It creates an event loop, then evaluates the supplied expression. If its result is a deferred value, it keeps running the event loop, until the deferred value is resolved, and returns its resolved value.
synchronise(expr)
If an error is not handled in the async phase, synchronise()
will
re-throw that error.
synchronise()
cancels all async processes on interrupt or external
error.
# \donttest{
http_status <- function(url, ...) {
http_get(url, ...)$
then(function(x) x$status_code)
}
synchronise(http_status("https://eu.httpbin.org/status/418"))
#> [1] 418
# }