Another option could be to store some attribute in the request scope and only call javaScriptSupport.addScript once on the server side.
On Wed, Feb 19, 2014 at 8:19 PM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: > On Wed, 19 Feb 2014 12:16:33 -0300, <la...@email.cz> wrote: > > javaScriptSupport.addScript("decorateBody();"); in @AfterRender method. >> It works, but when I use more of my components in one page, >> "decorateBody();" >> call is called x times, where x is number of components on the page. >> > > That's very easy and Tapestry-agnostic to do: just have your function to > set some variable or add an attribute to a DOM element to mark that it was > already called once. When running, check whether it was already called. If > not, run as normal. Otherwise, just don't do anything. > > > -- > Thiago H. de Paula Figueiredo > Tapestry, Java and Hibernate consultant and developer > http://machina.com.br > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Dmitry Gusev AnjLab Team http://anjlab.com