https://github.com/jareware/backbone-touchbind
https://github.com/jareware/backbone-touchbind
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/jareware/backbone-touchbind
- Owner: jareware
- Created: 2012-01-19T17:51:14.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2012-03-09T21:48:46.000Z (over 14 years ago)
- Last Synced: 2025-03-17T18:09:35.690Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 197 KB
- Stars: 12
- Watchers: 1
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
backbone-touchbind
==================
Quick PoC to demonstrate convenient binding of "fastclick" events to [Backbone Views](http://documentcloud.github.com/backbone/). The fastclicks (or "fast buttons") themselves are a solved problem, so I use the (lovely) [Mobile Boilerplate](http://html5boilerplate.com/mobile) for that.
Idea
----
Binding the `MBP.fastButton`s "manually" to each applicable element within the View, and using [custom jQuery events](http://api.jquery.com/trigger/) 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/