diff options
author | Yuriy Glukhov <yuriy.glukhov@gmail.com> | 2018-01-03 21:47:59 +0200 |
---|---|---|
committer | Yuriy Glukhov <yuriy.glukhov@gmail.com> | 2018-01-05 16:40:51 +0200 |
commit | c93655e8b492dacbf35e5152e716035e112c899f (patch) | |
tree | f0b62b7039a7dd53bfa7456312252bbcd6c61c24 /lib/js | |
parent | 67ac1aef594a328997fc9d3f6b36a73fc583f2ba (diff) | |
download | Nim-c93655e8b492dacbf35e5152e716035e112c899f.tar.gz |
Unify async macro and futures for js and native targets
Diffstat (limited to 'lib/js')
-rw-r--r-- | lib/js/asyncjs.nim | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/js/asyncjs.nim b/lib/js/asyncjs.nim index ec410ee39..3c488dcfe 100644 --- a/lib/js/asyncjs.nim +++ b/lib/js/asyncjs.nim @@ -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 |