If fun
is not a function, an error is thrown.
is_async(fun)
Logical scalar, whether fun
is async.
Currently, it checks for the async
attribute, which is set by
async()
.
f <- function(x) 42
af <- async(f)
is_async(f)
#> [1] FALSE
is_async(af)
#> [1] TRUE
f()
#> [1] 42
synchronise(dx <- af())
#> [1] 42
dx
#> <deferred>
#> Public:
#> cancel: function (reason = "Cancelled")
#> catch: function (...)
#> clone: function (deep = FALSE)
#> event_emitter: NULL
#> finally: function (on_finally)
#> initialize: function (action = NULL, on_progress = NULL, on_cancel = NULL,
#> share: function ()
#> then: function (on_fulfilled)
#> Private:
#> action: NULL
#> add_as_parent: function (child)
#> cancel_callback: NULL
#> cancelled: FALSE
#> children: list
#> dead_end: FALSE
#> event_loop: event_loop, R6
#> get_info: function ()
#> id: 272
#> make_error_object: function (err)
#> maybe_cancel_parents: function (reason)
#> mycall: call
#> null: function ()
#> parent_reject: function (value, resolve)
#> parent_resolve: function (value, resolve)
#> parents: NULL
#> progress: function (data)
#> progress_callback: NULL
#> reject: function (reason)
#> resolve: function (value)
#> run_action: function ()
#> running: TRUE
#> shared: FALSE
#> state: fulfilled
#> type: async
#> update_parent: function (old, new)
#> value: 42