Package sc.lang.js

Class JSRuntimeProcessor

  • All Implemented Interfaces:
    java.io.Serializable, IRuntimeProcessor

    public class JSRuntimeProcessor
    extends DefaultRuntimeProcessor
    This class implements the Java to Javascript conversion process. It defines a StrataCode runtime processor, which is attached to it's own LayeredSystem instance (i.e. layeredSystem.runtimeProcessor). The JS runtime has it's own complete set of layers, types, etc All types in the JS runtime are initialized, started, validated, processed, then transformed. The JSRuntimeProcessor hooks into these basic steps. The generation works in the following stages: - the start method is called for each type. It computes the list of jsFiles - the javascript files we are either generating (jsGenFiles) or js library files (jsLibFiles). It also builds up the set of entryPoints. These are types with MainInit or MainSettings annotations that are created when the application is loaded. jsModuleFile types are also added to this list. Essentially it is the set of types which are mapped as 'required' for a given jsFile. - the getProcessedFiles method is called by the build system. It generates the javascript code for each Java class - (these files are stored in the web/js/types directory of the build dir for debugging). Each of these js type files is a direct conversion of the Java code for that class only. It does not contain any dependency info and is not intended to be loaded directly. Instead those files are rolled up in the postProcess method into the files to be loaded by the browser. - the postProcess method is called after all types have been processed. It generates the jsGenFiles by rolling up the individual .js files in the proper order.. For each changed gen file, it iterates over all of the entry points that are defined to be in that file. Each entry point first makes sure all of the extends classes which are in the same file get added to the file first. A base class must be defined before the sub-class is defined. After the dependent types have been loaded, the entryPoint type is itself added to the file. It's possible inner types might extend the outer main type and so those are added after the main entry point class.
    See Also:
    Serialized Form