[Seaside] Re: Re: Re: Re: SUPeriodical - changing the frequency
onthe fly
Frank Sukhu
fsukhu at gmail.com
Fri Aug 25 15:31:55 UTC 2006
Thanks for your help - of course it worked perfectly.
There a few bits that I still do not understand.
1. Where does the "arguments[0]" - come from? who fills in the array
"arguments"?
2. I see in your example code that you have a line of debugging code:
'console.log("change", arguments)'. Does this result in the information
being written tothe Javascript console? This would be so useful but in my
environment it complains about "console". How do I get this to work?
I can continue my work witout the answers to these questions but it would be
nice to know how this works.
Again, many thanks,
Frank
"Lukas Renggli" <renggli at gmail.com> wrote in message
news:67628d690608240956s6498a7dal939fc42edc2a85a6 at mail.gmail.com...
> > Is there any way to do what I want using Scriptaclous?
>
> Sure, try something like this:
>
> html div
> id: 'time';
> script: (html periodical
> frequency: frequency;
> callback: [ :r | r render: Time now ];
> assignTo: 'updater');
> with: Time now.
>
> html div id: 'track'; with: [ html div id: 'handle' ].
> html script: (html slider
> handleId: 'handle';
> trackId: 'track';
> value: frequency;
> range: (1 to: 10);
> onChange: (SUStream on: 'console.log("change",
> arguments);updater.stop();updater.frequency=arguments[0];
> updater.start();'))
>
> The last part is slightly ugly as I wrote some bare JavaScript. You
> could archive exactly the same by composing a script like:
>
> html javascript
> add: (html periodical
> alias: 'periodical';
> stop):
> add: (html periodical
> ....
>
> but this gets too cumbersome in my opinion. I usually suggest that you
> write more complicated functionality in bare JavaScript (use #script
> or a class extension to SULibrary) and call it from your code using
> simple configurable objects. This scales usually much better.
>
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
More information about the Seaside
mailing list