events for mouse and touch in one
This module uses a modified Touchy.js to create normalized events for touch and mouse. The focus is on touch events, and this module is for building user interfaces for that paradigm.
Currently only three events are supported, "touchdown", "deltavector", and "liftoff", which are analogous to touchstart, touchmove, and touchend, as well as mousedown, mousedrag, and mouseup. A hover event may added, but that is a mouse-only event until the physical computing space gets a little more intimate. Until then, use mouse-around
npm install touchdown
This module is the event core for UXER, a user interface library with same goals as above.
var event = require'touchdown';var el = documentgetElementById'sweetSpot';eventstartel;// element is now registered for three events, so add listeners:eladdEventListener'touchdown' touchdowneladdEventListener'deltavector' vectorChangeeladdEventListener'liftoff' liftoffvar eventDetails = edetail;var pointOfContact = eventDetailsx eventDetailsy// ...var eventDetails = edetail;var pointOfContact = eventDetailsx eventDetailsyvar vector = eventDetailsvectorvar lastPoint = eventDetailslastPoint// ...var eventDetails = edetail;var pointOfContact = eventDetailsx eventDetailsyvar vector = eventDetailsvectorvar lastPoint = eventDetailslastPointvar allPoints = eventDetailsallPoints// ...
registers the element for events, and starts
registers the element, but events will not be fired until resume(element) is called
pauses an element, so events will not be called until resumed
resumes emitting events on that element
end emitting events on that element