This is an automated email from the ASF dual-hosted git repository.
carlosrovira 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 306257f refactor Modules to Features and concepts section
306257f is described below
commit 306257ff2d5e2f2fdb7bea93bfe4a03234ada177
Author: Carlos Rovira <[email protected]>
AuthorDate: Sat Aug 24 23:43:00 2019 +0200
refactor Modules to Features and concepts section
---
_data/toc.json | 6 +++---
create-an-Application.md | 2 +-
.../application-tutorial/production.md | 17 +++++++----------
.../circular-dependencies.md | 22 ++++++++++++----------
.../features}/modules.md | 1 +
5 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/_data/toc.json b/_data/toc.json
index f6b5359..0659a58 100644
--- a/_data/toc.json
+++ b/_data/toc.json
@@ -33,6 +33,9 @@
},
{
"path": "welcome/features/view-states.md"
+ },
+ {
+ "path": "welcome/features/modules.md"
}
]
},
@@ -240,9 +243,6 @@
"path": "create-an-application/security.md"
},
{
- "path": "create-an-application/modules.md"
- },
- {
"path": "create-an-application/code-conventions.md"
},
{
diff --git a/create-an-Application.md b/create-an-Application.md
index ba1d02f..be50d1c 100644
--- a/create-an-Application.md
+++ b/create-an-Application.md
@@ -33,7 +33,7 @@ This document is divided into several sections:
[Security](create-an-application/security.html) provides more information
about making sure hackers can't use your app to be malicous and about dealing
with common security restrictions when your app wants to access external
resources.
-[Modules](create-an-application/modules.html) discusses how to break your
application into pieces so it doesn't have to all get downloaded at once. Or
have the whole thing compiled at once.
+[Modules](welcome/features/modules.html) discusses how to break your
application into pieces so it doesn't have to all get downloaded at once. Or
have the whole thing compiled at once.
[Royale code conventions](create-an-application/code-conventions.html)
explains the typical ways Royale developers name files, classes, function,
variables and more.
diff --git a/create-an-application/application-tutorial/production.md
b/create-an-application/application-tutorial/production.md
index 9ca02f6..86d547e 100644
--- a/create-an-application/application-tutorial/production.md
+++ b/create-an-application/application-tutorial/production.md
@@ -16,15 +16,18 @@
layout: docpage
title: Making a production version
+description:
---
# Making a production version
+releasing an application for consumers
+
The version in the "js-debug" folder is considered a "debug version" or
"development version". If you looked at all of the files in the folder or
copied them to a web server, you probably noticed there are quite a few, and
that each takes time to load.
These versions are designed to be more easily debugged. Each source file has
an equivalent .js file with nice, readable variable and function names. If the
files are small enough and fast enough, it is perfectly fine to deploy the
development version.
-A production version will combine just about all of the .js into a single .js
file, renaming variables and function names from things like "Application" to
just "aa". This is done using the <a
href="https://developers.google.com/closure/compiler/" target="_blank">Google
Closure Compiler</a> and the results are easier to manage (fewer files to copy)
and also should load more quickly (because there are fewer requests for files
and smaller total file sizes).
+A production version will combine just about all of the .js into a single .js
file, renaming variables and function names from things like "Application" to
just "aa". This is done using the [Google Closure Compiler
(GCC)](https://developers.google.com/closure/compiler/){:target='_blank'} and
the results are easier to manage (fewer files to copy) and also should load
more quickly (because there are fewer requests for files and smaller total file
sizes).
If you are using an IDE, it probably provides an option for creating a
production version. On the command line, to create a production version, don't
set debug=true. The compiler will still produce the js-debug folder, but it
then will pass it to the Google Closure Compiler that will generate a
production or "release" version in a "js-release" folder.
@@ -32,23 +35,17 @@ The build process will take longer as the Google compiler
crunches through all o
On the command line, create a production version by running:
-```
-<path to Royale SDK>/royale-asjs/js/bin/mxmlc GitHubCommitsViewer.mxml
-```
+`<path to Royale SDK>/royale-asjs/js/bin/mxmlc GitHubCommitsViewer.mxml`
If you've used NPM to install Royale, you can just run:
-```
-mxmlc GitHubCommitsViewer.mxml
-```
+`mxmlc GitHubCommitsViewer.mxml`
Then if your browser worked when you viewed the application in the js-debug
folder, you can review the production version the same way in the js-release
folder; or you can copy the js-release folder to your webserver.
You will probably not see any rows of commits. And if you look in the
console, you may see an error that looks like:
-```
-TypeError: undefined is not an object (evaluating 'e.Vf.Qf')
-```
+`TypeError: undefined is not an object (evaluating 'e.Vf.Qf')`
Why is the production version not working? Because as the Google Closure
Compiler renamed variables, it also renamed variables in the code that fetches
fields from the data.
diff --git
a/create-an-application/migrate-an-existing-app/circular-dependencies.md
b/create-an-application/migrate-an-existing-app/circular-dependencies.md
index d869507..2212d90 100644
--- a/create-an-application/migrate-an-existing-app/circular-dependencies.md
+++ b/create-an-application/migrate-an-existing-app/circular-dependencies.md
@@ -16,23 +16,27 @@
layout: docpage
title: Circular dependencies
+description:
---
# Circular dependencies
-In software, a circular dependency is a relation between two or more modules
which either directly or indirectly depend on each other to function properly.
An extreme example, which could not work, is:
-```actionscript
+
+In software, a circular dependency is a relation between two or more classes
which either directly or indirectly depend on each other to function properly.
An extreme example, which could not work, is:
+
+```as3
public class A extends B
public class B extends A
```
-Circular dependencies cause a tight coupling of what should be independent
modules. This makes it difficult to re-use one module without its partner. When
a developer makes a small change in one of the co-dependent modules, there may
be unexpected effects on the other module, leading to poor application behavior
or compile-time errors. in the worst case, a circular dependency can generate
an infinite recursion leading to a crash or hanging the system.
+
+Circular dependencies cause a tight coupling of what should be independent
classes. This makes it difficult to re-use one class without its partner. When
a developer makes a small change in one of the co-dependent classes, there may
be unexpected effects on the other class, leading to poor application behavior
or compile-time errors. in the worst case, a circular dependency can generate
an infinite recursion leading to a crash or hanging the system.
## What compiling for Flash allows
You can get away with some circular dependencies when developing an
application in Flex or Royale that will be compiled for use in Flash or the AIR
environment. You can write code like this:
-```actionscript
+```as3
public class Child {
public var parent:Parent;
}
@@ -47,7 +51,6 @@ In Flash and AIR the runtime constructs both classes before
type-checking for pa
Royale uses the <a href="https://developers.google.com/closure/compiler/"
target="_blank">Google Closure Compiler</a> (GCC) to compile your application
into JavaScript that can run on browsers and mobile phones without heavy
plugins like Flash. GCC "parses your JavaScript, analyzes it, removes dead code
and rewrites and minimizes what's left. It also checks syntax, variable
references, and types, and warns about common JavaScript pitfalls."
-
GCC does not like circular dependencies that Flash allows. The reason is that,
in development mode, each class is loaded by a separate script element, so
there has to be a well-defined order to load these scripts. GCC also wants each
class to declare the classes it uses via an API called goog.require. So in the
Flash example above, Child will have goog.require('Parent') and Parent will
have goog.require('Child') and GCC doesn't know which file to load first and it
doesn't really want to [...]
Fortunately, the Royale compiler has an option called -remove-circulars that
is on by default. It analyzes the code and determines which goog.require to
remove so GCC won't complain about the circularities and can load the scripts
in the right order. However, if you want to know how to refactor your code so
that you don't create what GCC considers to be circular dependencies, read on.
@@ -56,7 +59,7 @@ GCC recommends refactoring interdependent classes to use
interfaces. Some folks
You would define two interfaces like this:
-```actionscript
+```as3
public class IChild {
}
@@ -69,13 +72,12 @@ Note that neither interfaces states that the implementation
must reference the o
Anyway, with these interfaces, the classes look like:
-```actionscript
+```as3
public class Child implements IChild {
-public var parent:IParent;
+ public var parent:IParent;
}
public class Parent implements IParent {
-public var child:IChild;
+ public var child:IChild;
}
```
-
diff --git a/create-an-application/modules.md b/welcome/features/modules.md
similarity index 99%
rename from create-an-application/modules.md
rename to welcome/features/modules.md
index 7a46cb0..b0672c9 100644
--- a/create-an-application/modules.md
+++ b/welcome/features/modules.md
@@ -16,6 +16,7 @@
layout: docpage
title: Modules
+description: Break you Application in parts
---
# Modules