You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/12/08 01:40:06 UTC

[royale-docs] branch master updated: add text to this section

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/royale-docs.git


The following commit(s) were added to refs/heads/master by this push:
     new 771827c  add text to this section
771827c is described below

commit 771827c7959cb4b0feeabd17e1943f4fb776176c
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Dec 7 17:39:55 2018 -0800

    add text to this section
---
 create-an-application/modules.md | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/create-an-application/modules.md b/create-an-application/modules.md
index feeefcd..c924600 100644
--- a/create-an-application/modules.md
+++ b/create-an-application/modules.md
@@ -20,4 +20,32 @@ title: Modules
 
 # Modules
 
-*This information will be available soon.*
+Royale supports a distributed development model called Modules.  Those familiar with Apache Flex will recognize the term.  Royale modules work almost identically to Flex modules with a few differences.
+
+## Why Modules?
+
+As your application grows in size, it means you will by default be loading more and more code just to show the first screen of your application.  In many cases, a complex application will have many screens.  The first screen may just be a login screen, for example.  If your users may be on slow or busy (or expensive) networks, you will want to load as little code as possible to show the first screen and load other code in the background or on-demand.
+
+Also, as your application grows in size, the number of files of code you are writing will probably grow as well and compile-time will increase.  And, you may have teammates helping develop some of these files.  Having to coordinate changes in the various files and wait for long compile-times is expensive.  If you have properly designed your application, you will know that not every file needs to be re-compiled when other files change, so having one teammate work on one set of files while [...]
+
+A Module is a separate compilation session of one or more source files that results in output that can be loaded later by the main application.
+
+A module can contain code that doesn't have an UI or it can be mostly UI.  Modules are most commonly used to load other UI screens and associated UI logic.  There is a ModuleLoader component that will display the UI components that are children of a Module.  MXML files are commonly used to specify the UI components.  There is an example in the examples/royale/ModuleExample folder.
+
+Proper use of modules can help maintain "separation of concerns" which helps keep you from writing "spaghetti code".  If only the code in one module changes, only that module needs to be recompiled.  And if that code isn't needed to show the first screen, then the application will start up faster.
+
+## Compiling modules
+
+Typically, a Module is developed in a separate folder of source files and the output is generated as a sibling to those source files, which then cannot be easily access by the output of the main app.  In JavaScript output, in development mode, lots of files are generated by the compiler.  All of these files must be relocated into the main app's output folder so that the main app can reference it via the same relative path when the module is compiled into a single output file in productio [...]
+
+## Using modules
+
+Modules are loaded by specifying the path to the main JavaScript file for the module.  If you are also working with Flash/AIR output, you can specify the .swf suffix and the Royale ModuleLoader will replace that with .js as needed.
+
+## Differences from Flex modules
+
+A potentially important difference between Flex modules and Royale modules is how memory is managed.  The Flash/AIR runtimes support the concept of unloadable code via a class called ApplicationDomain.  If you load a SWF in Flash or AIR and then remove all references to its code and instances, the SWF and the code definitions will be freed from memory.
+
+There is currently no emulation of ApplicationDomain in Royale.  Royale modules all load into the same global variable scope as the main application.  It might be possible to emulate ApplicationDomain, but it will likely be expensive.  The benefit of having unloadable code in JavaScript may not be as compelling as for Flash/AIR.  In Flash, SWFs are compressed binaries so they cannot be further compressed when downloaded over the network.  The code in a SWF was an intermediate byte code i [...]
+
+