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

start-drag

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

start-drag

Listens and composes mouse or touch events to dragging callbacks

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-77.78%
Maintainers
0
Weekly downloads
 
Created
Source

start-drag

npm version npm downloads

This package is a small utility that listens and composes mouse or touch events to dragging callbacks.

Install

npm i start-drag

Usage

import { strtr } from 'start-drag';

element.addEventListener('mousedown', (event) => {
	const destroy = startDrag(
		event,
		document.body,
		(event: MouseEvent, x: number, y: number, relX: number, relY: number) => {
			console.log(x, y, relX, relY);
		},
		(event: MouseEvent) => {
			console.log('end');
		},
	);

	// call destroy to stop listening
	destroy();
});

License

MIT License

Keywords

FAQs

Package last updated on 08 Jul 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