I think the way to go is not to expose them / use them directly in onClick.
Instead you bind them in a module (either using t5/core/dom or jquery).
That way you are also keeping your global (script) scope much cleaner.

Lots of the tapestry framework client side code use this pattern.

-- 
Chris


On Mon, Sep 5, 2016 at 11:52 AM, Qbyte Consulting <qbyteconsult...@gmail.com
> wrote:

> Okay, after splitting my JS up into logical pieces and deploying them using
> the module approach I can get jquery mobile to work. Perhaps the loading
> times or sequence of script run was breaking things before?
>
> Some trivial behaviours I added to a sidebar including a swipe out:
>
> (function () {
>     define(["jquery"], function ($) {
>
>         $("#go").click(function () {
>             $("#sidebar").show("fast");
>         });
>         $("#stop").click(function () {
>             $("#sidebar").hide("fast");
>         });
>         $("#sidebar").on("swipeleft", function () {
>             $("#sidebar").hide("slow");
>         });
>     });
> }).call(this);
>
> My locate module, I couldn't get to drips with the utils url extender so
> have coded manually:
>
> (function () {
>     define(["t5/core/ajax"], function (ajax) {
>         geoLocate = function (eventLinkURI) {
>             if (navigator.geolocation) {
>                 navigator.geolocation
>                         .getCurrentPosition(function (position)
>                         {
>                             var geolink = eventLinkURI
>                                     + "?lat=" + position.coords.latitude
>                                     + "&long=" + position.coords.longitude;
>                             ajax(geolink, null);
>                         }, geoError);
>             }
>         };
>         function geoError() {
>             alert('There was a problem determining your location. Some
> features may not be available.');
>         }
>         return {
>             geoLocate: geoLocate
>         };
>     });
> }).call(this);
>
> I still can't figure out how to access functions defined in modules
> directly using onclick= though, any ideas how to export them for direct
> client side access?
>
> On Fri, Sep 2, 2016 at 9:49 PM, Qbyte Consulting <
> qbyteconsult...@gmail.com>
> wrote:
>
> > I tried to add jquery mobile to my T5.4 project for swipe but it cracks
> > up. Same for angularjs.
> >
> > Is there additional config required to add js libraries? Since I have
> > jquery set up already I figured I could just add the mobile.
> >
> > Sent from my iPhone
> >
> > > On 2 Sep 2016, at 19:40, Thiago H de Paula Figueiredo <
> > thiag...@gmail.com> wrote:
> > >
> > >> On Fri, 02 Sep 2016 15:18:24 -0300, Svein-Erik Løken <
> sv...@jacilla.no>
> > wrote:
> > >>
> > >> I cannot find any swipe and touch JavaScript library in Tapestry. Are
> > there any plans to include one in Tapestry in the future?
> > >
> > > No, as it's pretty easy to use almost any JS library or framework
> inside
> > Tapestry. ;) :)
> > >
> > >> If it is - I will use that library now. The Tapestry dev team use to
> > find the best library :) It seems that Hammer JS and Touch Swipe are
> > popular(?). Any recommendation?
> > >
> > > I'm sorry, but I haven't used any of them.
> > >
> > > --
> > > Thiago H. de Paula Figueiredo
> > > Tapestry, Java and Hibernate consultant and developer
> > > http://machina.com.br
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > > For additional commands, e-mail: users-h...@tapestry.apache.org
> > >
> >
>

Reply via email to