summary refs log tree commit diff stats
path: root/tests/ecmas.nim
blob: 59e7ae1e847c022cc430e2c308caff006361dc4f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# This file tests the ECMAScript generator

import
  dom, strutils

# We need to declare the used elements here. This is annoying but
# prevents any kind of typo:
var
  inputElement {.importc: "document.form1.input", nodecl.}: ref TElement

proc OnButtonClick() {.exportc.} =
  var x: int = parseInt($inputElement.value)
  echo($(x * x))

proc OnLoad() {.exportc.} = 
  echo("Welcome! Please take your time to fill in this formular!")