Skip to content

Commit

Permalink
add news item + document
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Aug 22, 2024
1 parent 4fc6b02 commit f7e6ea3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# coro (development version)

* Async functions created by `coro::async()` now return their
`promises::promise()` invisibly (#46, @shikokuchuo).

# coro 1.0.4

* Internal fix for R-devel.
Expand Down
10 changes: 6 additions & 4 deletions R/async.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#'
#' @param fn An anonymous function within which `await()` calls are
#' allowed.
#' @return A function that returns a [promises::promise()].
#' @return A function that returns a [promises::promise()] invisibly.
#'
#' @seealso [async_generator()] and [await_each()];
#' [coro_debug()] for step-debugging.
Expand Down Expand Up @@ -75,9 +75,11 @@ await <- function(x) {
#' @return A chainable promise.
#' @export
async_sleep <- function(seconds) {
promises::promise(function(resolve, reject) {
later::later(~ resolve(NULL) , delay = seconds)
})
invisible(
promises::promise(function(resolve, reject) {
later::later(~ resolve(NULL) , delay = seconds)
})
)
}

#' Construct an async generator
Expand Down
2 changes: 1 addition & 1 deletion man/async.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f7e6ea3

Please sign in to comment.