Some components need specific js init.
if you have a look inside Tapestry.js and search for Tapestry.Initializer

you will find

/** Container of functions that may be invoked by the Tapestry.init()
function. */
Tapestry.Initializer = {

 ajaxFormLoop : function(spec)
    {
....    },

and lots of function.

So when ajaxFormLoop for exemple do
 void cleanupRender()
    {
        popContext();

        JSONObject spec = new JSONObject();

        spec.put("rowInjector", rowInjector.getClientId());
        spec.put("addRowTriggers", addRowTriggers);

        renderSupport.addInit("ajaxFormLoop", spec);
    }

 produce to call to ajaxFormLoop define in Tapestry.Initializer at browser
side







2010/11/9 Nicolas Barrera <nbarr...@gmail.com>

> I believe the difference is that
>
> addInit
>
> adds your javascript on an onLoad event handler of the current page.
>
>
> while
>
> addScript
>
> adds your javascript at the very bottom of the page (last element before
> closing body), within a <script> tag in which many components of the
> current
> page can add javascript there.
>
> I think the difference is the moment when javascript will be executed, with
> addInit in the moment the page finishes loading and with addScript whenever
> the browser reaches the <script> tag.
>
> as i see it, javascript added with addScript is executed before the one
> added with addInit.
>
>
> hope that helps, and hope not being wrong :)
>
> cheers
>
> Nicolás.-
>
>
> On Tue, Nov 9, 2010 at 5:07 AM, iberck <ibe...@gmail.com> wrote:
>
> >
> > Hello forum, I have a question
> >
> > What is the diference between renderSupport.addInit(); and
> > renderSupport.addScript();
> > since two methods adds a javascript function that runs on dom loaded
> >
> > Thanks in advance
> >
> > --
> > View this message in context:
> >
> http://tapestry.1045711.n5.nabble.com/Diference-between-addInit-and-addScript-tp3256418p3256418.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
> >
> >
>

Reply via email to