Stuff for JavaScript


JavaScript (a.k.a. ECMAScript) is one of the world's most misunderstood programming languages. This is probably because it started out in a very hostile environment - web browsers - and portability across web browsers was, at the time, quite poor. Nowadays JavaScript itself is very portable, and the incompatibilities have moved into the browser parts on which JavaScript typically operates: HTML DOM elements. Nonetheless, JavaScript is making a comeback as a powerful part of the AJAX programming idiom. This page is my little corner for evangelizing the language.

v8-juice

v8-juice is a library for extending the Google v8 JavaScript engine. It is similar in spirit to SpiderApe (see below), but targets a different JS engine.

SpiderApe

SpiderApe is a C++ library based on top of Mozilla's SpiderMonkey JavaScript Engine. SpiderMonkey is the only freely-available JS engine for C/C++ developers, but it is unfortunately quite poorly documented and it can be difficult to work with. SpiderApe (an "ape" being a "bigger, stronger monkey"), is a wrapper around some of the more tedious-to-use SpiderMonkey parts, making it really simple to integrate the JS engine into C++ applications and libraries. Its most useful features include easy-to-use, type-safe conversion between JS and C++ data types, plus the ability to add new JS functionality (functions and classes) via plugins (on Unix-like platforms, anyway).

Javascript source code packers

There are several JS source code packers available on the net:
  • Douglas Crockford's jsmin is a rudimentary packer which simply removes extraneous spaces and comments from source code. The main advantage is that it's ANSI C code, so it should compile and run everywhere.
  • This one is only available for online packing (via copy/paste into a textarea field).
  • Dean Edwards has JS packers in several languages.
  • Nicolas Martin ported Dean Edwards' packer to PHP5.
  • Here is my extended version of Nicolas Martin's port:
    jspacker-php-20070716.zip (8415 bytes, last modified 2009.Jul.27)
    This one accepts input via stdin and writes to stdout, so it is more Unix-friendly than Nicolas' original version. (My changes have been sent back to Nicolas for inclusion into his version.)
Note that the JS source code packing process may remove the license text from a JS script, which may violate the code's license. It is considered good manners to re-insert the license text back into the packed code.

jQuery

jQuery is an impressive JS toolkit for working with HTML DOMs. You can find out more about it, as well as download my plugins for jQuery, on my jQuery pages.