Merge pull request #7023 from yglukhov/unify-async

Unify async macro and futures for js and native targets
This commit is contained in:
Dominik Picheta 2018-01-17 15:06:32 +00:00 • committed by GitHub
commit b754bfabb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 4 deletions

View file

@ -139,3 +139,7 @@ macro async*(arg: untyped): untyped =
proc newPromise*[T](handler: proc(resolve: proc(response: T))): Future[T] {.importcpp: "(new Promise(#))".}
## A helper for wrapping callback-based functions
## into promises and async procedures
proc newPromise*(handler: proc(resolve: proc())): Future[void] {.importcpp: "(new Promise(#))".}
## A helper for wrapping callback-based functions
## into promises and async procedures