Commit bc32c214 authored by Benjamin Summerton's avatar Benjamin Summerton

It kind of works?

parent e129e969
......@@ -94,16 +94,19 @@ when defined(js) and not defined(nodejs):
# For browser JS
proc getTicks_internal(): Ticks =
{.emit: ["return performance.now() * 1000000;"].}
when defined(nodejs):
elif defined(nodejs):
# For NodeJS Targets
proc getTicks_internal(): Ticks =
{.emit: ["return process.hrtime()[1];"].}
when defined(macosx):
elif defined(macosx):
# For OS X
from times import epochTime
proc getTicks_internal(): Ticks=
return (epochTime() * 1_000_000_000).Ticks
else:
# For Linux & Windows
proc getTicks_internal(): Ticks=
......
......@@ -3,7 +3,8 @@ from sequtils import map
# Choose where to get the "sleep" function from
when defined(js):
# NOTE: This isn't giving me the result I want...
proc sleep(ms: int) =
{.emit: ["return new Promise(resolve => setTimeout(resolve,", ms, "));"].}
else:
......@@ -109,7 +110,9 @@ when defined(js) and not defined(nodejs):
# Call test inside body.onload for browser JS
dom.window.onload = proc(e: dom.Event) =
test()
elif defined(nodejs):
# No CLI args either
test()
else:
for kind, key, val in getopt():
if (kind == cmdArgument) and (key == "nolap"):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment