Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-touch

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-touch

Simple library to manage touch events

  • 0.1.0-beta.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

(work in progress)

High performance and easy to use with minimal code to manage Touch.

I think this is going somewhere, I make another way of listening to touch event in very simple code, I just check where touched, then it find the id of your element in events if you bind some.

Work in progress and I have so much to do, so I just create that for my Corodva Music Player App (named Wikiseda on google play) and it work perfect on Webkit and IE10+. (Also added mouse as fallback for touch)

Fork and pull requests are highly welcome!

Development

git clone [this project git]

cd simple-touch

npm install

Use

npm install simple-touch

Touch = require 'simple-touch'

Touch.onTap "close-menu" # it's just id of my element in html
.onStart (event) =>

	event.listener.style.backgroundColor = 'rgba(0,0,0,.1)'

.onEnd (event) =>

	event.listener.style.backgroundColor = ''

.onTap (event) =>

	closeMenu()
timeout = null

Touch.onTap "long-press-me"
.onStart (event) =>

	event.listener.style.backgroundColor = 'rgba(0,0,0,.1)'

	timeout = setTimeout =>

		console.log "long press on ", event.listener

	, 700

.onEnd (event) =>

	event.listener.style.backgroundColor = ''
	clearTimeout timeout

Touch.onPan "pan-me"
.onPan (event) ->

	return if event.totalY > -10

	# check out event by running console.log(event)

TODO

  • Tap count
  • Swipe

FAQs

Package last updated on 19 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc