IMO, a SpectrumApplication should either have a custom HTML template that loads 
the Spectrum css or a wait mechanism to allow the individual components to load 
the CSS.

I feel like we are trying to solve multiple problems at the same time.  Let's 
try to focus on just one.

A component's "initialization" is the code that run while the APIs are set up, 
such as:

org.apache.royale.Foo = function()
{
}

org.apache.royale.foo.prototype.bar = function()
{
}

The instantiation of constructor/method functions and assigning them to these 
slots should be CSS and PNG/SVG independent.  Static initializers should be 
lazy in most cases.

Next is the "instantiation" phase when some code actually runs "new Foo()".

IMO, the challenge is that some scripts may not be loaded by the time "new 
Foo()" runs.  But that is a different problem than having code around during 
the initialization phase.  What are the patterns that require external code for 
initialization?  And then what are the patterns for "instantiation"?

Most/All of the Application classes support deferred startup to allow for 
things needed for instantiation phase.  I think this thread is about the 
"initialization" phase and I still don't understand the use cases.

Then there is Spectrum and its CSS usage.  If Spectrum has one single CSS file 
it should be loaded as is.  If Spectrum has multiple CSS files then they must 
have some mechanism to order them and we should be trying to replicate that 
mechanism instead of creating a new one.  If the goal is to come up with a 
mechanism to divide up a single CSS file and make it PAYG per component, that 
is a subject for a new thread.

My 2 cents,
-Alex

On 5/19/20, 12:26 PM, "Harbs" <harbs.li...@gmail.com> wrote:

    Comments inline.
    
    > On May 19, 2020, at 7:47 PM, Alex Harui <aha...@adobe.com.INVALID> wrote:
    > 
    > IMO, we want to avoid overuse of this feature such that we should not 
need specifying order.  There should be very few places where this is truly 
needed.  It is tempting to use it for other things, but it really should only 
be used when the initialization of the class and prototype requires it.
    
    I totally agree that we want to avoid this as much as possible in Royale 
code, but I’ve needed extensive use of including CSS for my work with Spectrum.
    
    Spectrum is particular on the order of the loaded CSS, hence the need to 
specify order. 
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fadobe%2Fspectrum-css%2Fissues%2F481&amp;data=02%7C01%7Caharui%40adobe.com%7C2010efb914374d0d290208d7fc2a7a7d%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637255131709815050&amp;sdata=dRGOGtlcLQnq10apvYSX64CJoOH8RaKJBotBwLA7R%2BA%3D&amp;reserved=0
 
<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fadobe%2Fspectrum-css%2Fissues%2F481&amp;data=02%7C01%7Caharui%40adobe.com%7C2010efb914374d0d290208d7fc2a7a7d%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637255131709820030&amp;sdata=gPFQ7N0h2YXQnrmXmBw7JUM632CGCpCZpkcHnkFwsOk%3D&amp;reserved=0>
    
    I’m currently using inject_html in Spectrum, but it’s not a very good 
solution and I need to reorder the included CSS.
    
    > What would be a scenario where a PNG or SVG file is required to 
initialize a class?
    
    Skinning and icon sets of libraries come to mind.
    
    For example: Spectrum has its set of required icons which are saved as SVG. 
Including that in a SWC simplifies library use.
    
    

Reply via email to