Unify async macro and futures for js and native targets

This commit is contained in:
Yuriy Glukhov 2018-01-03 21:47:59 +02:00
commit c93655e8b4
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