Skip to content
Frank Wienberg edited this page Mar 14, 2014 · 2 revisions

The Jangaroo Runtime

The result of compiling Jangaroo code is JavaScript code that is interpreted 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 artifact as joo/joo- debug.js.

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

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

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

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.

Clone this wiki locally