[Seaside] How to avoid too many callbacks

Lukas Renggli renggli at gmail.com
Thu May 1 15:54:16 UTC 2008


> I made a working example, but i want to know if it is possible to simplify it.

Instead of defining a global function showCell and hardcoding the
onclick handler in the html for every cell you could iterate over the
elements in question (in this case that would be the anchors that have
the CSS class clickable):

   html selector
      add: 'a.clickable';
      do: [ :each | each element on: 'click' do: (html updater ...) ]

> 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

Good ;-)

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside mailing list