Socket
Book a DemoInstallSign in
Socket

@yandeu/tap

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yandeu/tap

🖱️ Handling of user interactions such as mouse, touch and pointer events. (Inspired by tapjs)

0.1.2
latest
Source
npmnpm
Version published
Weekly downloads
114
-16.18%
Maintainers
1
Weekly downloads
 
Created
Source

🖱️ Tap

Handling of user interactions such as mouse, touch and pointer events.
(Inspired by tapjs)

Installation

npm install @yandeu/tap

CDN

https://unpkg.com/@yandeu/tap/umd/tap.min.js

Usage

// print the current version
console.log('Tap VERSION: ', Tap.VERSION)

// the element you want to listen for events (your canvas for example)
const el = document.getElementById('myCanvas')

// instantiate
const tap = new Tap(el)

// listen on down
tap.on.down(({ position, event }) => {
  console.log('down', position, event)
})

// listen on move
tap.on.move(({ position, event, dragging }) => {
  console.log('move', position, event)

  const isDragging = dragging
  console.log('Is pointer down while moving?', isDragging)
})

// listen on up
tap.on.up(({ position, event }) => {
  console.log('up:', position, event)
})

// listen on down once
tap.once.down(({ position, event }) => {
  console.log('down', position, event)
})

// check if down
tap.isDown

// get current position
tap.currentPosition

// get last position
tap.lastPosition

// is pointer lock available
tap.pointerLock.available

// is pointer locked
tap.pointerLock.isLocked

// listen for pointer lock change once (returns a Promise)
tap.pointerLock.onceChange().then(event => {
  console.log(event)
})

// request pointer lock (returns a Promise)
tap.pointerLock.request().then(event => {
  console.log(event)
})

// request pointer lock (returns a Promise)
tap.pointerLock.exit().then(event => {
  console.log(event)
})

// check if paused
tap.isPaused

// pause all events (except .once())
tap.pause()

// resume all events
tap.resume()

// destroy all events once you are done
tap.destroy()
PackageDescription
audio🎵 Audio library for the Web Audio API.
keyboard⌨️ Handling of keyboard events.
tap🖱️ Handling of user interactions such as mouse, touch and pointer events.

Questions?

Join the enable3d discussions!

License

MIT

Keywords

tap

FAQs

Package last updated on 07 Jan 2023

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.