mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-28 10:13:56 +00:00
JS codegen improvements; barely usable now
This commit is contained in:
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)
|
||||
|
||||
Reference in New Issue
Block a user