added asyncjs standard library module (#6841)
This commit is contained in:
parent
a879973081
commit
a9ba02e8c9
5 changed files with 150 additions and 8 deletions
26
tests/js/tasync.nim
Normal file
26
tests/js/tasync.nim
Normal 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)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue