flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: FlexJS, JQuery and FDT
Date Thu, 21 Apr 2016 00:17:58 GMT
Looks like the externs file doesn't have an @type for the $ constant.  You
can try adding it in the build script or see if Google will accept a patch
for it.

-Alex

On 4/20/16, 4:13 PM, "Harbs" <harbs.lists@gmail.com> wrote:

>Replacing “$” with “jQuery” makes the warnings go away. Why would “$” be
>different than “jQuery”? It sounds to me like a bug in the definitions.
>
>jQuery always returns a JQuery object which has many defined methods. One
>of those is attr.
>
>On Apr 21, 2016, at 1:50 AM, Alex Harui <aharui@adobe.com> wrote:
>
>> IMO, this is why Jquery is painful for strong typing.
>> 
>> I think you may need to do casting:
>> 
>> 	($("#topcoat") as Whatever).attr(..)
>> 
>> Where Whatever is a "type" that has an attr function.
>> 
>> And you may need to use @flexjsignorecoercion or other compiler options
>>to
>> not actually do the "as" test in the JS output.
>> 
>> Good luck,
>> -Alex
>> 
>> 
>> On 4/20/16, 3:46 PM, "Harbs" <harbs.lists@gmail.com> wrote:
>> 
>>> Here’s an example:
>>> $("#topcoat").attr("href", "css/topcoat-desktop-lightlight.min.css");
>>> 
>>> It looks like “$” is defined as an object.
>>> 
>>> Here’s the exact warnings I’m getting:
>>> 
>>> Could not resolve variable (may be a dynamic member) 'attr' at line 43
>>> column 19.	ThemeManager.as	/MyExtension/src/com/unhurdle	Unknown	Flash
>>> Problem
>>> Maybe invoking a non function. Found
>>> $("#topcoat").attr("href","css/topcoat-desktop-lightlight.min.css"); at
>>> line 43 column 
>>> 5.	ThemeManager.as	/MyExtension/src/com/unhurdle	Unknown	Flash Problem
>>> 
>>> And yes, js/libs/jquery.swc is included. If I remove it, I get an error
>>> that “$” is not defined instead of a warning.
>>> 
>>> On Apr 21, 2016, at 1:39 AM, Alex Harui <aharui@adobe.com> wrote:
>>> 
>>>> 
>>>> 
>>>> On 4/20/16, 3:34 PM, "Harbs" <harbs.lists@gmail.com> wrote:
>>>> 
>>>>> Does anyone know if there’s a way to get FDT to not flag JQuery
>>>>> expressions with “could not resolve variable” and "Maybe invoke a
non
>>>>> function” warnings?
>>>> 
>>>> What kind of expressions result in this output?  Are you sure you have
>>>> the
>>>> jquery.swc from the externs on the -external-library-path?
>>>> 
>>>> -Alex
>>>> 
>>> 
>> 
>

Mime
View raw message