On Wed, May 2, 2012 at 8:47 AM, trsvax <[email protected]> wrote:
> One thing that would be helpful along with using data- would be the ability
> to run a script once. Perhaps something like:
>
> javascriptsupport.runOnce("('.zoneLink').init()");
>
> So no matter how many times you include the component you only get one init
> call.

That's something I've been struggling with ... its easy enough to
track such calls on the server during a single page render, but how do
you account for prior executions when you are doing an Ajax partial
page update?  I suspect it involves more tracking on the client.

On the other hand, if that bit of logic was incorporated into a
module, you would get the just-once behavior for free, it would
probably look more like:

define(["core/jquery"], function($) {
 $("body").on("click", ".zoneLink", ... );
});


On the server side, something like:

  javaScriptSupport.module("core/zoneLink");
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Script-Loaders-Modules-and-other-JS-thoughts-tp5676390p5680899.html
> Sent from the Tapestry - Dev mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>



-- 
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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to