Download Get the PDF - Docs

Transcript
qooxdoo Documentation, Release 1.6.1
How Packages are Merged
(This is a more theoretical section, but it is kept here for the time being; if you are only looking for how-to information,
you can skip this section).
During what we call part collapsing, some packages are merged into others. That means the classes that are contained
a source package are added to a target package, and the source package is deleted from all parts referencing it.
Obviously, it is crucial that the target package is referenced in all those parts where the source package was referenced
originally, so that a part is not loosing the classes of the source package. This is taken care of by the selection process
that for any given source package picks an appropriate target package. (Target packages are searched for in the set of
already defined packages, and there are no new packages being constructed during the collapsing process).
After the source package has been merged into the target package, and has been removed from all parts, there are two
cases:
• For parts that referenced both (source and target) package initially, there is no difference. The same set of classes
is delivered, with the only difference that they come in one, as opposed to two, packages.
• Parts that only reference the target package now reference more classes then they really need. But this should
be acceptable, as either negligible (in the case of merging packages by size), since the additional weight is
marginal; or as without negative effect (in the case of merging by load order), since the “overladen” package is
supposed to be loaded earlier with some other part, and will already be available when this part is loaded.
Collapsing By Package Size
Collapsing by package size is straight forward. You can specify a minimal package size (in KB) that applies to all
packages of your application. If a package’s size, and it is its compiled size that matteres here, is beneath this threshold
the package will be merged into another. This avoids the problem of too much fragmentation of classes over packages,
and trades optimally distributing the classes (to always load only necessary classes) for minimizing net requests (when
loading packages for a part).
Collapsing by size is disabled by default. You enable it by specifying size attributes in your parts configuration:
"packages" :
{
"sizes"
:
{
"min-package" : 20,
"min-package-unshared" : 10
},
...
}
The min-package setting defines a general lower bound for package sizes, the min-package-unshared, which defaults
to min-package if not given, allows you to refine this value specifically for those packages which pertain to only one
part.
Collapsing By Load Order
Collapsing by load order is always useful when you know in advance the order of at least some of your parts, as they
are loaded during the app’s run time. This is e.g. the case when you have a part that uses other parts to do its work (a
big dialogue that has sub-controls like a tabview). The enclosing part is always loaded before its sub-parts can be used.
Or there is a part that is only accessible after it has been enabled in another part. These situations can be captured by
assigning a load order to (some of) your parts in your configuration.
9.5. Parts
311