Sorry, Nicolas, you are quite wrong.

The difference is that using RenderSupport. addScript() you are adding raw
JavaScript that gets executed when the page loads.

When using RenderSupport.addInit() you are referencing client-side
functions, defined on the Tapestry.Initializer object, to be executed with a
set of parameters.

Note 1: You should be using JavaScriptSupport in Tapestry 5.2 which is a
replacement for RenderSupport (which is deprecated).

Note 2: Using RenderSupport.addInit() /
JavaScriptSupport.addInitializerCall() allows you to write the bulk of your
page initialization as a static JavaScript library, with just a minimal
amount of per-page initialization. You also get some control over when that
initialization occurs, and you get (for free) some exception catching and
reporting if the initialization fails.

Having big blocks of JavaScript as ugly literals inside a Tapestry page is a
design smell: it should be turned into client-side JS in a library, and
calls to JavaScriptSupport.addInitializerCall().



On Tue, Nov 9, 2010 at 5:31 PM, Nicolas Barrera <nbarr...@gmail.com> wrote:

> The execution moment difference is a consequence of the
>
> only real difference, which afaik is how they add the script, one as
> handler
> of the on load event (add init),
>
> the other just as a <script> tag right before closing the body tag.
>
> perhaps anyone else can confirm this is the only difference,
>
> bye
>
> Nicolás.-
>
>
> On Tue, Nov 9, 2010 at 6:55 PM, iberck <ibe...@gmail.com> wrote:
>
> >
> > Thank you for your responses
> >
> > So, is the execution moment the only diference ?
> >
> > Thanks in advance guys
> > --
> > View this message in context:
> >
> http://tapestry.1045711.n5.nabble.com/Diference-between-addInit-and-addScript-tp3256418p3257752.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to learn
how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

Reply via email to