How to make your hybrid mobile app respond faster!

While working on a hybrid mobile app I noticed that the JS Click event (hooked up via jQuery) had an annoying response delay after I tested the iOS build of the app.

I figured that the translation of the device’s touch-event via JavaScript caused the delay and so I set myself to finding a nice JS library that handles touches fast n snappy and hopefully would give me the tools to handle the most common gestures also.

I found the solution for the delay problem in a nice mobile JS library called Hammer.js. Their motto: You CAN touch this! (gotto love that!).

I checked out their website and Github repo and started testing the responsiveness using two buttons on the same screen, one setup with the standard click event and one via hammer.js. It was very clear after one press on each button that hammer.js has a very fast response and so I am using it as the premiere gesture/click event handler for my hybrid mobile apps right now.

You can use a singleton approach that handles all the interaction on the entire screen and hook up gesture- and touch-events to get theinteraction flowing. With an easy syntax like the following it’s now sweat integrating this one into your Phonegap project: