Created
October 9, 2021 13:29
-
-
Save martin-c/023b70c4296cbe415348d0150df99207 to your computer and use it in GitHub Desktop.
nim asyncjs example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncjs | |
import dom | |
import jsconsole | |
import jsffi | |
{.push importjs: "navigator.usb.$1()".} | |
proc getDevices: PromiseJs | |
{.pop.} | |
proc test: PromiseJs {.async.} = | |
getDevices() | |
proc main = | |
log("Hello from Nim!") | |
let p = await getDevices() | |
log(jsTypeOf p) | |
if isMainModule: | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment