Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To start, Titanium precompiles your JavaScript to minify it. Titanium's pre-compiler statically analyzes your code and builds a dependency hierarchy of all the Titanium APIs used by your application. The front-end compiler's job is to create native stub files. These stubs include appropriate platform-specific native code, a native project file (if necessary), and any specific code that is necessary to compile Titanium code for a given platform compiler. Finally, Titanium calls out to the platform-specific compiler tools (for example, xcodebuild for iOS) to compile the final native application.

On the iOS side, your JavaScript is Base64 encoded, inlined as a variable in a C file, and is then compiled. Your JavaScript is not converted to Objective-C. It remains Javascript and is interpreted at runtime using the JavaScriptCore interpreter. On Android, your JavaScript is precompiled to bytecode. At runtime, your code is interpreted by the Rhino/V8 JavaScript interpreter. In both cases, your Your JavaScript code will be encrypted when you build your app for "production" (a.k.a.: release version) or for device. Your original code is not retrievable in any sort of human-readable form.

 

Hands-on Practice

Goal: create a default project and examine the resulting files.

...