Yes, it should be that simple. If we could make the compc compiler able to
(optionally) generate externs from ActionScript files somehow, that would
make using third-party libraries easier. I think most developers would be
more comfortable writing a few classes in ActionScript for a third-party
library, and then running compc with some kind of --externs=true (or maybe
--typedef=true) option that generates externs in the SWC.

- Josh

On Mon, Dec 12, 2016 at 8:01 AM, Alex Harui <aha...@adobe.com> wrote:

>
>
> On 12/11/16, 11:56 PM, "Harbs" <harbs.li...@gmail.com> wrote:
>
> >I thought I tried something similar and declaring the types did not help
> >(i.e. the externs were not generated), but maybe I did something wrong.
> >
> >I’ll try again.
> >
> >> The reason to create an AS API for a 3rd party library is more than just
> >> preventing renaming.  It is to allow the compiler to check your code so
> >> you don't also get hosed by typing zip["fnerateNdeStrm"]  Or pass it
> >> "{typ: "nodbufr"}.  If you don't want to use strong typing, why use
> >>FlexJS
> >> in the first place?
> >
> >In general I agree, but if you’re just doing simple with some third party
> >library, it should be possible to just copy some JS code which works,
> >make minor changes and be good to go.
> >
> >I’m bringing this up, because it’s been a pain point for me in my current
> >project.
>
> I'm not sure whether it is truly possible to grab any JS, insert it in AS
> and compile it so that it will survive renaming without outputting every
> property as quoted values, which effectively turns off all renaming.  And
> then we'd get complaints about total size.  And the compiler wouldn't
> catch nearly enough stuff.  IMO, the productivity advantage of FlexJS is
> better served by an eco-system of typedefs for third party libraries.  The
> creation of the typedefs should be as "simple" as creating the two AS
> files.
>
> My 2 cents,
> -Alex
>
>

Reply via email to