Skip to content

omahlama/backbone-touchbind

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

backbone-touchbind

Quick PoC to demonstrate convenient binding of "fastclick" events to Backbone Views. The fastclicks (or "fast buttons") themselves are a solved problem, so I use the (lovely) Mobile Boilerplate for that.

Idea

Binding the MBP.fastButtons "manually" to each applicable element within the View, and using custom jQuery events to combine them seamlessly with the listeners bound to this.el by Backbone.View.delegateEvents(). This "manual work" can of course be "automated", see below.

Usage

During View initialization (or whenever you recreate your view elements, such as when you'd re-render a template into this.el), call this.addFastButtons(). To avoid having to repeat yourself, put it to a shared base class for your views. The only thing you have to do, then, to use fastclicks in derived views is:

events: {
    'fastclick button': 'handleFastClick'
}

handleFastClick: function() {
    // do stuff
}

License

http://sam.zoy.org/wtfpl/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%