JS codegen improvements; barely usable now
This commit is contained in:
parent
fe285b354d
commit
f2af2fb478
4 changed files with 71 additions and 25 deletions
23
tests/js/test1.nim
Normal file
23
tests/js/test1.nim
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
discard """
|
||||
cmd: "nimrod js --hints:on $# $#"
|
||||
output: "1261129"
|
||||
"""
|
||||
|
||||
# This file tests the ECMAScript generator
|
||||
|
||||
import
|
||||
dom, strutils
|
||||
|
||||
var
|
||||
inputElement = "1123"
|
||||
|
||||
proc OnButtonClick(inputElement: string) {.exportc.} =
|
||||
let v = $inputElement
|
||||
if v.allCharsInSet(whiteSpace):
|
||||
echo "only whitespace, hu?"
|
||||
else:
|
||||
var x = parseInt(v)
|
||||
echo x*x
|
||||
|
||||
onButtonClick(inputElement)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue