Re: how to render access to a JS argument variable?

Johan Brichau <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
Hi Chris,

I notice you figured out the use of #alias: 

Use the JS generation facilities only when you need to *generate* code. For example, to embed a server-side callback or, in general, when the code can only be dynamically constructed.
In your case, I would do the following:

(JSStream on: ‘console.log(event)’)

Just because you can write it in Smalltalk does not mean you should :)

Johan

ps: your contributions are in my inbox, I will process them asap

> On 09 Oct 2015, at 03:46, Chris Muller <[email protected]> wrote:
> 
> Found something.  JSAlias.
> 
>>    html span
>>         class: 'PufMessageWidget' ;
>>         id: (self assureHtmlIdUsing: html) ;
>>         onClick: ((html javascript logger call: 'log' with: 'event')
>> asFunction: #('event')).
> 
> I gave up on onClick: since I guess its better to set up event
> bindings through jQuery's API.  This binding does what I want, no
> syntax error.
> 
>     html script defer with:
>          ((html jQuery id: (self assureHtmlIdUsing: html)) onClick:
>               ((html javascript logger call: 'log' with: (html
> javascript alias: 'event')) asFunction: #('event'))).
> 
> It seems like a pretty wordy way to write console.log(event), but the
> intent reads clearly so, that's good..
> _______________________________________________
> seaside mailing list
> [email protected]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.