added asyncjs standard library module (#6841)

This commit is contained in:
Alexander Ivanov 2017-12-19 01:34:55 +02:00 • committed by Andreas Rumpf
commit a9ba02e8c9
5 changed files with 150 additions and 8 deletions

26
tests/js/tasync.nim Normal file
View file

@ -0,0 +1,26 @@
discard """
disabled: true
output: '''
0
x
'''
"""
import asyncjs
# demonstrate forward definition
# for js
proc y(e: int): Future[string]
proc x(e: int) {.async.} =
var s = await y(e)
echo s
proc y(e: int): Future[string] {.async.} =
echo 0
return "x"
discard x(2)