Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
core event lib for touch, multi touch and click
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.md
package.json
touchdown.js
touchy.js

README.md

touchdown!

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.

usage

var event = require('touchdown');
var el = document.getElementById('sweetSpot');
event.start(el);

// element is now registered for three events, so add listeners:
el.addEventListener('touchdown', touchdown)
el.addEventListener('deltavector', vectorChange)
el.addEventListener('liftoff', liftoff)

function touchdown(e){
    var eventDetails = e.detail;
    var pointOfContact = [ eventDetails.x , eventDetails.y ]
    // ...
}

function vectorChange(e){
    var eventDetails = e.detail;
    var pointOfContact = [ eventDetails.x , eventDetails.y ]
    var vector = eventDetails.vector
    var lastPoint = eventDetails.lastPoint
    // ...
}

function liftoff(e){
    var eventDetails = e.detail;
    var pointOfContact = [ eventDetails.x , eventDetails.y ]
    var vector = eventDetails.vector
    var lastPoint = eventDetails.lastPoint
    var allPoints = eventDetails.allPoints
    // ...
}

api

.start(element)

registers the element for events, and starts

.register(element)

registers the element, but events will not be fired until resume(element) is called

.pause(element)

pauses an element, so events will not be called until resumed

.resume(element)

resumes emitting events on that element

.end(element)

end emitting events on that element

Something went wrong with that request. Please try again.