Thanks for your reply Howard. I was thinking of some "external sync". But is it a "Tapestry way" ? Maybe it would make sense to add kind of RenderSupport.addInitSingleton(...) or open up RenderSupport.getInit(String name) and check if it by yourself ? I would then write one liner Tapestry.Initializer.AjaxLoaderUrl that would address my js singleton problem.
Howard Lewis Ship wrote: > > I have a few cases like this. What I do is use a Request attribute to > determine if I've added the "static" initialization yet. You can see > an example of this, in trunk, for the DateField component, which only > wants to pass down the localization data once per render. > > On Mon, Nov 3, 2008 at 3:03 AM, Konstantin <[EMAIL PROTECTED]> wrote: >> >> I've created AjaxLoader mixin that I use on EventLink with zone param. It >> will add nice animated gif inside zone while zone content will be >> loading. >> >> JS part creates Tapestry.AjaxLoader class. >> I've also added Tapestry.Initializer.ajaxLoader with (linkId, zoneId, >> loaderURL) params which will simply create new TapestryAjaxLoader inside. >> >> So the question is: I don't want to pass 'loaderURL' param in every init >> request. I can introduce "static" member with >> Tapestry.AjaxLoader.loaderURL >> = '/images/...../loader.gif'. But where should I put that initializer ? >> If I >> put it like this: >> >> @AfterRender >> void afterRender(MarkupWriter markupWriter) { >> renderSupport.addScript("Tapestry.AjaxLoader.loaderURL = '%s';", >> ajaxLoader.toClientURL()); >> >> renderSupport.addInit("ajaxLoader", link.getClientId(), zoneId); >> } >> >> I end up with as many "Tapestry.AjaxLoader.loaderURL='...'" as I have >> eventLinks and zones in my page, but I want to have just one. >> Can you suggest some nice solution to my problem ? >> -- >> View this message in context: >> http://www.nabble.com/T5%3A-One-static-initializer-script-for-mixin-tp20300768p20300768.html >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > > -- > Howard M. Lewis Ship > > Creator Apache Tapestry and Apache HiveMind > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/T5%3A-One-static-initializer-script-for-mixin-tp20300768p20307751.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]