New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

touchboom

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

touchboom

Report touch/mouse events from the document

  • 0.2.52
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29
increased by7.41%
Maintainers
0
Weekly downloads
 
Created
Source

touchboom

MIT-license

touchboom

Reports inertial movement and key/touch/mouse events from the document. A reworking of the motion scripts found here, courtesy of Ariya Hidayat.

Try it out by visiting this page. Try clicking, dragging and releasing.

All handlers connect to the same data, so that mouse-originated glide motions continue alongside key-originated glide motions. One set of listeners are attached to the body from which all events are delegated so that behaviour may be bound many times.

Touchboom uses the legacy property event.keyCode with keyboard up, down, left, right, wasd events.

Run npm test and load the test page to see a demo.

//
// state is defined and mutated on cfg
//
let cfg = {};

//
// start coords = [ xcoord, ycoord ]
// all properties are optional
// 
cfg.coords = touchboom.coords([{
  bgn : 0
}, {
  autoweight : 10,
  bgn : 0,
  min : -400,
  max : 400
}]);

//
// target element must have id, used to manage delegation
// one set of listeners are attached body and delegated
// to touchboom functions assocated w/ element
//
rootelem.id = 'id-is-required';

//
// all event functions are optional,
//
//  * oneventfn, called when an event occurs
//    touchboom.events
//
//  * oninertiafn, called each 'frame' of movement
//    before and after touch/mouse release
//
//  * onmovefn, called when mouse is over element
//
touchboom.attach(cfg, rootelem, {
  oneventfn : function (cfg, etype, e) {
    if (etype === 'moveend') {
      // coords stopped moving
      console.log(touchboom.coordsgettotal(cfg));
    } else if (etype === 'end') {
      // mouse or finger are disengaged
      console.log(touchboom.coordsgettotal(cfg));
    }
  },
  oninertiafn : function (cfg, etype, e) {
      // coordinates are updated
      console.log(touchboom.coordsgettotal(cfg));
  }
});

scrounge

(The MIT License)

Copyright (c) 2016 Bumblehead chris@bumblehead.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords

FAQs

Package last updated on 24 Aug 2024

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