Thank you Josh, that's just the information I was looking for.  I'm getting
away with currently because I'm using "WHITESPACE_ONLY" currently, so no
re-naming.

I'm using WHITESPACE_ONLY since I'm loading multiple different apps at
runtime that share the same base code in a separate JS file.  Basically,
just like loading swf files at runtime only with JS files instead.

Kenny

On Mon, Jun 3, 2019 at 3:00 PM Josh Tynjala <[email protected]> wrote:

> COMPILE::JS should not be necessary, but if you're targeting JS, you
> should add the doc comment with the @externs tag. By default, Royale uses
> the Google Closure compiler, which aggressively renames properties and
> methods to make the generated code smaller. The @externs tag tells it not
> to rename any of the APIs on that particular class. If you have an external
> JS library included with <script>, you want to avoid this renaming or your
> calls to the external library will fail.
>
> Now, I saw that you said that you don't have the @externs tag, and things
> are working fine. It's worth mentioning that Closure compiler sometimes
> skips this renaming (I'm not sure why, but maybe it depends on your app's
> complexity). In the future, your code may cross some threshold where
> Clsoure compiler decides that it has changed its mind and wants to do the
> renaming after all, and suddenly your code that was working correctly will
> break. I had that happen a month or two ago. Code that was working for over
> a year suddenly had a couple of APIs renamed in the generated JS and it
> took me half an hour to realize it was because I had forgotten @externs on
> code that I hadn't touched in a very long time.
>
> (There's also a way to pass a certain compiler option through Royale to
> Closure compiler to disable the "ADVANCED_OPTIMIZATIONS" that handles the
> renaming. If you happen to be using the "SIMPLE_OPTIMIZATIONS" instead, you
> can probably get away with skipping @externs. I don't think many people are
> using this option, but it's worth mentioning as another possible reason why
> you might not have had an issue when @externs is missing.)
>
> - Josh
>
> On 2019/06/03 17:36:56, Kenny Lerma <[email protected]> wrote:
> > Looking at the demo, I noticed you added @externs and COMPILE::JS?  Is
> this
> > necessary?
> > I'm just curious since the ActionsScript I've done for creating external
> JS
> > code completion and SWC files too, I'm not adding these.
> >
> > Kenny
> >
> > On Mon, Jun 3, 2019 at 12:25 PM Carlos Rovira <[email protected]>
> > wrote:
> >
> > > Hi Andrew!
> > >
> > > just finished the last blog example, could you please take a look and
> fix
> > > whatever aggression against the English language that may have been
> > > committed? :)
> > >
> > >
> > >
> https://royale.codeoscopic.com/using-external-javascript-libraries-in-apache-royale/
> > >
> > > To the rest of folks: please let me know if you thing something is
> wrong or
> > > must be modified in some way.
> > >
> > > thanks in advance
> > >
> > >
> > > --
> > > Carlos Rovira
> > > http://about.me/carlosrovira
> > >
> >
>

Reply via email to