FlexJS can mean different things in different contexts. This document attempts to clarify the different parts of FlexJS and how they fit together.
There are three distinct parts of FlexJS:
- FlexJS Compiler
- FlexJS Framework
- FlexJS Typedefs
Core
FlexJS at its most basic level is the FlexJS Compiler. The compiler takes ActionScript code and outputs plain Javascript. The most obvious comparison to the FlexJS Compiler is TypeScript. When using the FlexJS Compiler as only a cross-compiler, it is used the same way the TypeScript compiler is used and the features are very similar.
The Framework
The FlexJS Framework is a collection of SWC files which can be used to make application development easier. This includes core language features in ActionScript which do not exist in Javascript, abstractions of HTML elements, component sets and more. If you are familiar with classic Flex Halo and Spark development for Flash and AIR applications, a large portion of the framework will feel familiar.
Typedefs
FlexJS Typedefs are SWC files designed to allow type-checking for application development. They contain the type definitions in ActionScript, but none of the actual implementation of the Javascript code. These are used for type-checking at compile-time, but are not cross-compiled and included as Javascript code for deployment. To use these typedef swcs, the native Javascript code libraries are linked at run-time in the HTML. These are very similar to TypeScript type definitions. By convention, typdef swcs are named in all lowercase to help differentiate them from swcs which are cross-compiled.
Putting the Pieces Together
The parts used for FlexJS development can drastically change depending on the type fo development being done. For example, Node.js development would require Node.js externs and module externs for used modules, but very little or none of the FlexJS Framework. Library development can be done using only the FlexJS Compiler. Development for WebGL can be done with the Compiler and some externs specific to that. An enterprise application similar to one classically done in classic Flex would probably use the full gamut of features.
The following is a diagram of typical FlexJS development: