EmTcl Test Page

This is a simple test page for running Tcl in the browser on the client side, courtesy of emscripten.

The box on the left holds input, the right holds output. You can

Hit 'Run!' to evaluate, inspect output, tweak input and re-run.

Hit Ctrl+Enter to use it in a more repl-like manner (which will clear the input box and generally make a vague effort to be a bit like tclsh).

You have two implementations to choose from - Tcl and JimTcl. Tcl (not JimTcl) comes with a toy library for changing attributes and styles of DOM elements. See the dom command example lines.

div#dom-a div.dom-child div#dom-b ul.dom-subchild li

li div#dom-c div#dom-d

span.dom-subchild #dom-playground

Run!

package require TclOO oo::class create summation { constructor {} { variable v 0 } destructor { variable v puts "Ended with value $v" } method add x { variable v incr v $x } } set sum [summation new] for {set i 1} {$i <= 10} {incr i} { puts "Add $i to get [$sum add $i]" } summation destroy # Toy DOM library written for the EmTcl demo dom attr "#dom-d > span" textContent CHANGE dom css #dom-playground backgroundColor red dom css "#dom-playground li" borderColor blue

Run!