The Jangaroo Runtime

The result of compiling Jangaroo code is JavaScript code that is intepreted in some JavaScript engine (browser, Rhino), with the help of a small runtime. This approach allows to generate code that (in debug compilation mode) is very close to your ActionScript source code. The runtime takes care of

  • interpreting package, import and class declarations,
  • interpreting member modifiers and initializers,
  • loading dependent classes,
  • establishing inheritance, and
  • initializing classes on their first usage.

The runtime also provides the entry point for starting your Jangaroo application from JavaScript.

All advanced runtime features are explained on the following pages.

Runtime Design

The runtime code consists of less than 100 lines of JavaScript bootstrap code and a few ActionScript classes. The ActionScript classes are compiled by jooc, and concatenated with the bootstrap code form the runtime joo/joo.js., resulting in a file of just about 32 kb (unzipped!). This approach is possible because the runtime ActionScript classes use only the most basic runtime features. As a Jangaroo application developer, you need not care about how the runtime has been built---just include joo/joo.js in your HTML page and you're done. If during debugging, you have the impression there  might be something wrong with the Jangaroo runtime or if you want to get a better understanding of its workings, you may want to try the runtime compiled in debug mode, which is available in the release and the corresponding Maven artefact as joo/joo-debug.js.

Lazy Class Initialization

In order to determine the sequence in which static code is to be executed, Jangaroo provides a feature called "lazy class initialization". more...

Automatic Class Loading

Jangaroo provides automatic class loading, which means loading the set of classes needed to run a main class. more...

Calling Jangaroo from JavaScript

You can seamlessly call Jangaroo code from JavaScript code. Here is the how-to. more...

Internal Design

As a Jangaroo application developer, you need not care about how the runtime has been built---just include scripts/jangaroo-runtime.js.If you are interested in the software design of the Jangaroo runtime or suspect a bug, read on. more...