This demo is a JavaScript interpreter. Type some code into
the text input and press enter to see the results. It uses
MochiKit's
MochiKit.DOM
to manipulate the display. It also supports waiting for
MochiKit.Async
Deferreds via blockOn(aDeferred).
To show the signature of a MochiKit function and link
to its documentation, type help(fn) on any MochiKit
function.
To write multi-line code snippets, use the lower text area
and press ctrl-enter or cmd-enter to submit.
function name() {} syntax might not end up in
window scope, so use name = function () {}
syntax instead
If you want to stuff something into the output window
other than the repr(...) of the expression
result, use the writeln(...) function.
It accepts anything that MochiKit.DOM does, so you can
even put styled stuff in there!
Use clear() to clear the interpreter window.
You can use blockOn(aDeferred) to wait on a
Deferred. This expression must be used by itself, so
the value must be obtained from _ or
last_exc. Typing any expression will
cancel the Deferred.
Up and down arrow keys work as a rudimentary history
_ is the value of the last expression
that was not undefined, last_exc is
the value of the last unhandled exception.
You can use importjs(url) to load javascript from an
external url. This will allow you to play around with
javascript libraries and functions from within the
interpreter. For example,
try importjs("/lib/jquery/jquery.js")
A kind of canvas is provided as a div with id
"ce" which contains a canvas tag with id
"canvas". This can be used to easily test things
like Processing.js
or other Javascript graphics toolkits.