I have no problem adding javascript libs using RequireJS. On my web site 60% of 
the end-users are using touch devices. To support then I have to handle some 
touch and swipe events. I think Tapestry also need to do that in upcoming 
versions.

From: Chris Poulsen [via Apache Tapestry Mailing List Archives] 
[mailto:ml-node+s1045711n5732956...@n5.nabble.com]
Sent: mandag 5. september 2016 15.00
To: Svein-Erik Løken <sv...@jacilla.no>
Subject: Re: Swipe and touch

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 <[hidden 
email]</user/SendEmail.jtp?type=node&node=5732956&i=0>
> 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 <
> [hidden email]</user/SendEmail.jtp?type=node&node=5732956&i=1>>
> 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 <
> > [hidden email]</user/SendEmail.jtp?type=node&node=5732956&i=2>> wrote:
> > >
> > >> On Fri, 02 Sep 2016 15:18:24 -0300, Svein-Erik Løken <
> [hidden email]</user/SendEmail.jtp?type=node&node=5732956&i=3>>
> > 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: [hidden 
> > > email]</user/SendEmail.jtp?type=node&node=5732956&i=4>
> > > For additional commands, e-mail: [hidden 
> > > email]</user/SendEmail.jtp?type=node&node=5732956&i=5>
> > >
> >
>

________________________________
If you reply to this email, your message will be added to the discussion below:
http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/Swipe-and-touch-tp5732951p5732956.html
To unsubscribe from users@tapestry.apache.org<mailto:users@tapestry.apache.org> 
Mailing List Archives, click 
here<http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2375125&code=c3ZlaW5AamFjaWxsYS5ub3wyMzc1MTI1fC0xNTM4NzY2ODg4>.
NAML<http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>

Reply via email to