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 - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

6

dist/TouchElement.d.ts

@@ -5,7 +5,7 @@ import { Emitter } from "@wildebeest/common";

protected emitter: Emitter;
protected touch: any;
protected touch: TouchEvent;
constructor(element: any, emitter: Emitter);
getEmitter(): Emitter;
protected setTouch(event: any): void;
protected onMove(event: any): void;
protected getFingerPosition(event: TouchEvent): any;
protected onMove(event: TouchEvent): void;
}

@@ -6,6 +6,7 @@ "use strict";

var _this = this;
this.touch = null;
this.element = element;
this.emitter = emitter;
this.element.addEventListener('touchstart', this.setTouch.bind(this));
this.element.addEventListener('touchstart', function (event) {
_this.touch = event;
});
this.element.addEventListener('touchend', function () {

@@ -19,8 +20,6 @@ _this.touch = null;

};
TouchElement.prototype.setTouch = function (event) {
this.touch = {
position: {
x: event.changedTouches[0].pageX,
y: event.changedTouches[0].pageY
}
TouchElement.prototype.getFingerPosition = function (event) {
return {
x: event.changedTouches[0].clientX,
y: event.changedTouches[0].clientY
};

@@ -32,9 +31,10 @@ };

}
var prevTouch = this.touch;
this.setTouch(event);
var lastPosition = this.getFingerPosition(this.touch);
var currentPosition = this.getFingerPosition(event);
var diff = {
horizontal: prevTouch.position.x - this.touch.position.x,
vertical: prevTouch.position.y - this.touch.position.y,
horizontal: lastPosition.x - currentPosition.x,
vertical: lastPosition.y - currentPosition.y,
};
this.emitter.emit('touchScroll', diff);
this.touch = event;
this.emitter.emit('wbTouchscroll', diff);
};

@@ -41,0 +41,0 @@ return TouchElement;

{
"name": "@wildebeest/touch",
"version": "0.2.0",
"version": "0.2.1",
"description": "Touch event module",

@@ -9,3 +9,4 @@ "main": "dist/index.js",

"build": "tsc --declaration",
"test": "jest"
"test": "jest",
"deploy": "npm run test && npm run build && git add -A && git commit -m 'deploy' && git push origin master"
},

@@ -12,0 +13,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

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