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

@wildebeest/touch

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

@wildebeest/touch

Touch event module

  • 0.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Drag Module

Add drag event to DOM elements. Drag event is triggered when user moves the mouse, while holding down left mouse button.

Installation

npm install --save @wildebeest/touch

Requirements

It's usefull to know these libraries:

  • inversify
  • @wildebeest/js-modules

Bind Element To Touch Component

Making element to emit wbTouchscroll, requires creating new instance of class TouchComponent.

foo(emitterService: EmitterService): void
{
    let element: any = document.querySelector('.touch-scroll');
    let component: TouchComponent = new TouchComponent(element, emitterService.createEmitter());
}

In our example we used .touch-scroll selector to select DOM element and then create TouchComponent, that will listen to specific changes on this element. If it finds touch, it will emit touch event.

Listen To Touchscroll Event

Touch event is called wbTouchscroll and the event contains three values horizontal and vertical finger position difference after last touch. touchEvent, which is the original TouchEvent.

foo(emitterService: EmitterService): void
{
    let element: any = document.querySelector('.touch-scroll');
    let component: TouchComponent = new TouchComponent(element, emitterService.createEmitter());

    dragable.getEmitter().on('wbTouchscroll' (data: any) => {
        let verticalMovement: number = data.vertical;
        let horizontalMovement: number = data.horizontal;
        let originalEvent: TouchEvent = data.touchEvent;
    });
}

Keywords

FAQs

Package last updated on 12 May 2019

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