Rye

Using a custom DOMEventEmitter

When you are writing a plugin, or a feature that should be independent from other events in the application, use a new DOMEventEmitter to isolate your event handlers:

var DOMEventEmitter = Rye.require('Events').DOMEventEmitter
  , element = $('#mything').get(0)
  , myEvents = new DOMEventEmitter(element)

myEvents.on({
    'click .button': function(){ ... }
  , 'mouseover li': function(){ ... }
})

myEvents.on('mousedown .that', function(){ ... })

// remove all events:
myEvents.destroy()

Touch Events

All touch events

        
Allow scrolling

        
Single tap only

        

All touch events

  • Container that captures all touch events.
  • Prevents default on touchmove, disabling scrolling.
  • Captures swipes in all directions.
  • Captures tap, singleTap (after delay), doubleTap, longTap

Allow scrolling

  • Container that allows scrolling while capturing all events except swipes in the direction of scroll
  • Prevents default on touchmove, disabling scrolling.
  • Captures swipes in all directions.
  • Captures tap, singleTap (after delay), doubleTap, longTap

Single tap only

  • Container that allows scrolling and captures only simple, single taps. eg: a button or a tappable list item
  • Cancels touch after tap, disabling other touch events (singleTap, doubleTap)
  • Captures tap