« Return to Thread: How to avoid too many callbacks

Re: Re: How to avoid too many callbacks

by Gerhard Obermann :: Rate this Message:

Reply to Author | View in Thread

Hi!
 
Its already a fully working example!
Now with the simplification suggested by Lukas!
 
renderContentOn: html
 html heading: 'Callback Test'.
  1 to: 100 do: [:idx | html anchor id: 'id_', idx asString;
       class: 'showCell';
       with: idx. html space.
       idx \\ 20 = 0 ifTrue: [html break]].
 html break.
 html div id: 'result'; with: [self renderResultOn: html].

 self session addLoadScript: (html selector
      add: 'a.showCell';
      do: [ :each | each element on: 'click' do: (html evaluator callback: [:script | script element id: 'result'; update: [:r | self renderResultOn: r]];
      callback: [:v | self result: v] value: (SUStream new nextPutAll: 'this.id'))]).

cheers
Gerhard
On Thu, May 1, 2008 at 6:39 PM, itsme213 <itsme213@...> wrote:
"Gerhard Obermann" <obi068@...> wrote in message

> BTW the test result shows a good performance gain without the 100
> callbacks.
>
> Render Time (with 100 callbacks) : 29 ms
> Render Time (with 1 callback) : 6 ms
> File Size (with 100 callbacks): 20736
> File Size (with 1 callback): 8611

Wow, looks like I could do this in some places in my app. Any chance you
could share the rest of this test/sample code?

Always amazed by how much I do not know :)

- Sophie



_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

 « Return to Thread: How to avoid too many callbacks