tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Lewis Ship <hls...@gmail.com>
Subject Re: Script Loaders, Modules, and other JS thoughts
Date Wed, 02 May 2012 16:34:07 GMT
On Wed, May 2, 2012 at 8:47 AM, trsvax <trsvax@gmail.com> 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: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message