The use case is that you want to get something up and running quickly that
the compiler won't complain about, even if there's no type-checking. If I
were to do something like this in one of my own projects, it would be
temporary so that I could focus on something else first, and I'd come back
and flesh things out later.

Another use case I should think is obvious: there's an actual global
variable or function loaded from a <script> tag or something that you want
to use in ActionScript:

package
{
    /**
     * @externs
     */
    public function globalFunction(param1:String, param2:Number):Boolean {}
}

- Josh

On Thu, Jan 19, 2017 at 1:23 PM, Alex Harui <[email protected]> wrote:

>
>
> On 1/19/17, 10:27 AM, "Josh Tynjala" <[email protected]> wrote:
>
> >Is it only supported on classes? Is it possible to add it to variables or
> >functions in packages too? As an example, I think something like this will
> >be a common quick-and-dirty workaround for accessing JS globals.
> >
> >package
> >{
> >    /**
> >     * @externs
> >     */
> >    public var myGlobal:Object;
> >}
>
> I didn't test it on anything other than a class.   Feel free to try it and
> maybe even fix it if it doesn't work.
>
> I'm not sure I understand this particular use case though.  If you are
> accessing a third-party library, usually there is more than just a global
> object in the APIs.  Are you just trying to prevent renaming on something?
>
> -Alex
>
>

Reply via email to