[Pas2js] htmlwidget in pas2j 2.2.0: pas.JS.isUndefined is not a function

Luca Olivetti luca at ventoso.org
Mon Aug 29 14:22:24 CEST 2022


El 29/8/22 a les 14:11, Michael Van Canneyt ha escrit:
> 
> 
> On Mon, 29 Aug 2022, Luca Olivetti wrote:
> 
>> As per the subject, I'm using pas2js 2.2.0 with fpc 3.2.2 and lazarus 
>> 2.2.2.
>>
>> Since I had problems with Pas2JS_Widget, I'm now back to the basics 
>> following this article:
>>
>> https://www.freepascal.org/~michael/articles/pas2js1/pas2js1.pdf
>>
>> and while the first method (page 12, plain javascript classes) works, 
>> if I try to use the second one (using the httpwidget unit, not the 
>> webwidget one as the article says) I get this error in firefox:
>>
>>
>> Uncaught TypeError: pas.JS.isUndefined is not a function
>>    EventEntry webwidget.pas:2640
>>    cb rtl.js:256
>>    cb rtl.js:256
>>    HookupEvent webwidget.pas:2665
>>    AddEvent webwidget.pas:2690
>>    SetHTMLEvent webwidget.pas:2477
>>    DoRun login.lpr:27
>>    Run custapp.pas:206
>>    $main login.lpr:62
>>    run rtl.js:141
>>    <anonymous> login.html:51
>> webwidget.pas:2640:10
> 
> very strange, it works here. if I look in the Javascript, I can see the
> function.
> 
> Can you look in the generated .js file, you should see something like:
> 
>    this.isUndefined = function (v) {
>      return v == undefined;
>    };
>    this.isDefined = function (v) {
>      return !(v == undefined);
>    };

Yes, the snippet is there

> 
> Are you using optimizations ? If so, please try adding -O- in the custom
> options of the compiler.

Same error (plus 3 warnings "unreachable code after return statement")

Bye
-- 
Luca


More information about the Pas2js mailing list