Google FastButtons Implemented as a knockout.js Custom Binding
##Preventing the 300ms Delay in Mobile Javascript Apps One of the complaints with developing mobile apps in html and javascript is that they are not as responsive as native apps. Some of that is related to the way webkit handles click events on touch devices. The browser delays for 300ms to be sure you aren’t double tapping.
There are several options for removing the delay, including Max Ogden’s masseuse.js, which aims to be a more complete add in for handing mobile events.
Another popular option is to implement Google’s Fast Button code. In order to use Fast Buttons with knockout.js, we can easily encapsulate the behavior in a custom binding for use in all mobile apps that use the powerful MVVM framework.
If you click the buttons on a mobile device you will see that there is a noticeable delay with the first button and an instant result with the fast click version. Every third of second counts when making a responsive app.
Regular Click
- button
- result
- Waiting for click...
Google FastButton Click
- button
- result
- Waiting for click...
The fastButtons implementation is by Alex Black and here is the html and knockout custom binding.
And here is the view model initializaiton.