Rhino+Dashboard… it’s like crack
If you are a JavaScript junkie who is in constant need of a fix… here’s a little Dashboard trick I like to use to keep an interactive JavaScript prompt available at all times.
(works for Python and Ruby junkies too)
- Download the WidgetTerm Dashboard Widget. WidgetTerm is basically like Terminal.app in Widget form (although I believe it’s actually based on the open source iTerm application).
- Download Rhino 1.6… Mozilla’s Java-based implementation of JavaScript 1.5 + E4X + JS interactive interpreter + JS-2-Java bridge.
-
After unpacking Rhino, put its
js.jarfile on your classpath. If you’re not a Java developer, this is easy… just dropjs.jarin~/Library/Java/Extensions. - Now edit this file:
~/.bashrcin your text editor of choice. If it doesn’t exist, just create it. Place the following line in that file:alias js='java org.mozilla.javascript.tools.shell.Main'Quit and restart Terminal.app (or just source .bashrc). You now have access to a command-line interactive JavaScript interpreter just like the ones provided by Python and Ruby. All you have to do is open a Terminal.app window and type
js. BAM… live JavaScript interpreter. - Now then… You have installed WidgetTerm right? Good. Activate Dashboard and drag a new WidgetTerm Widget out from the Widget Bar onto the screen. Type
js.
There you have it. Now accessing a live JavaScript interpreter is as easy as activating Dashboard.
Since Python and Ruby both have interactive interpreters by default, you can use this trick for them too… I like to have a Python and a JavaScript WidgetTerm open at all times. ![]()
About this entry
You’re currently reading “Rhino+Dashboard… it’s like crack,” an entry on Todd Ditchendorf’s Blog.
- Published:
- 02.27.06 / 10am
- Category:
- JavaScript/DHTML, Mac OS X, Python, Rhino, Ruby, Web Development

No comments
Jump to comment form | comments rss [?] | trackback uri [?]