Skip to content

Instantly share code, notes, and snippets.

@tvandervossen
Created November 4, 2011 10:25
Show Gist options
  • Select an option

  • Save tvandervossen/1339061 to your computer and use it in GitHub Desktop.

Select an option

Save tvandervossen/1339061 to your computer and use it in GitHub Desktop.
Callback or custom event?
Hey, I’m playing around with a multitouch gesture recognition API
for Mobile Safari. Now I’m wondering; would you prefer to define the
event handler in a callback, like this:
recognize.tap(element, function() {
log('Tapped');
});
Or would you prefer the recognizer to fire a custom event, like this:
recognize.tap(element);
element.bind('tap', function() {
log('Tapped');
});
Which one do you like best? Why?
@tvandervossen

Copy link
Copy Markdown
Author

@mislav I’m familiar with Zepto but for anything but trivial multitouch support you can’t get away from having to define gesture recognizers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment