Hi Paul. > I'm not sure what you mean by that statement Josh, I'm proposing a useful > utility method inseparable from the tapestry js api so that other users > don't have to write and embed the method themselves also.
What I'm saying is that Tapestry isn't a general purpose javascript library. As Thiago has pointed out there are features in the framework that allow you to inject javascript into the page so that it's run at the appropriate time. It sounds like you are trying to work outside of these mechanisms. Maybe if you explained what you wanted to do from a higher level someone could provide advice on how to accomplish your goals within the framework. Josh On Sun, Mar 6, 2011 at 3:52 PM, Paul Stanton <p...@mapshed.com.au> wrote: > "I don't think we need to replicate functionality provided by javascript > libraries." > > Tapestry provides onDOMLoaded and waitForPage .. the functionality I > describe isn't provided by Tapestry or a javascript library (since the js > lib would need to know about the Tapestry js api). > > I'm not sure what you mean by that statement Josh, I'm proposing a useful > utility method inseparable from the tapestry js api so that other users > don't have to write and embed the method themselves also. > > p. > > On 7/03/2011 10:44 AM, Josh Canfield wrote: >>> >>> seems to work, but I can see the need to make the callbacks parameterised >>> in >>> the future (which currently isn't supported by Tapestry.onDOMLoaded) >> >> Callbacks are closures, why do you need parameters? >> >>> If something like this doesn't exist in tapestry already, I think it >>> should. >> >> I don't think we need to replicate functionality provided by >> javascript libraries. >> >> Josh >> >> On Sun, Mar 6, 2011 at 3:12 PM, Paul Stanton<p...@mapshed.com.au> wrote: >>> >>> In lieu of a better (tapestry provided) solution, this is what i'm using. >>> It >>> seems to work, but I can see the need to make the callbacks parameterised >>> in >>> the future (which currently isn't supported by Tapestry.onDOMLoaded) >>> >>> function callWhenPageLoaded(callback) >>> { >>> if (typeof(Tapestry) == "undefined") >>> throw("callWhenPageLoaded called too early"); >>> >>> if (Tapestry.pageLoaded) >>> callback.call(this); >>> else >>> Tapestry.onDOMLoaded(callback); >>> } >>> >>> If something like this doesn't exist in tapestry already, I think it >>> should. >>> >>> p. >>> >>> On 7/03/2011 9:44 AM, Paul Stanton wrote: >>>> >>>> Hi all, >>>> >>>> i'm using tapestry 5.1.0.5 on this particular project. >>>> >>>> I'm not 100% sure this isn't already available, but before duplicating >>>> logic i thought I'd check... >>>> >>>> I need to be able to call a function at any point in the page state (ie >>>> before it's loaded, during loading, after load) but have it wait until >>>> tapestry.init has been called. >>>> >>>> Kind of how Tapestry.waitForPage works, except that if the page has not >>>> loaded, instead of showing a dialog, it would register it for invoking >>>> once >>>> the page is loaded. >>>> >>>> so in psuedo: >>>> >>>> function(callback) >>>> { >>>> if(Tapestry.pageLoaded) >>>> invoke(callback); >>>> else >>>> Tapestry.onDOMLoaded(callback); >>>> } >>>> >>>> 2 questions: >>>> a) is this functionality already available? where? >>>> b) would the above approach be fool-proof? ie would there be a case >>>> where >>>> Tapestry.pageLoaded == false and Tapestry.onDOMLoaded would still not >>>> invoke >>>> the callback? >>>> >>>> thanks, p. >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>> >>>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >>> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org