Socket
Socket
Sign inDemoInstall

@okiba/drag-emitter

Package Overview
Dependencies
3
Maintainers
3
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @okiba/drag-emitter

Unified drag events emitter for mouse and touch


Version published
Maintainers
3
Created

Readme

Source

Okiba / DragEmitter

Emits drag events for all common pointers kinds (touch & mouse)

Untranspiled code. 🛑

Okiba is transpiled for browser usage only. If you use it in production, don't forget to transpile it with your bundler.

__

Installation

You can grab it as an npm package

npm i --save @okiba/drag-emitter

Or use it in the browser

<!-- Minified -->
<script src="https://unpkg.com/@okiba/drag-emitter@0.2.8/dist/index.min.js"></script>

<!-- Full -->
<script src="https://unpkg.com/@okiba/drag-emitter@0.2.8/dist/index.js"></script>

constructor(el)

import {DragEmitter} from '@okiba/drag-emitter'
import {qs} from '@okiba/dom'

const dragEmitter = new DragEmitter(qs('.container'))
dragEmitter.on(
  'drag',
  ({deltaX, clientX, deltaY, clientY}) => {
    console.log(deltaX, clientX, deltaY, clientY)
  }
Arguments
+ el: Element

Element whose surface is used for drag events

destroy()

Unbinds events from the element and deletes the reference. To be called when the instance is not needed anymore for cleanup.

Keywords

FAQs

Last updated on 01 Apr 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc