Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
wheel-gestures
Advanced tools
wheel gestures and momentum detection in the browser
Install wheel-gestures using your package manager:
yarn add wheel-gestures # OR npm install wheel-gestures
Import and create an instance of WheelGestures and then add the element you want to observe.
import { WheelGestures } from 'wheel-gestures'
// create an instance per element
const wheelGestures = WheelGestures()
// find and observe the element the user can interact with
const element = window.document.querySelector('.slider')
wheelGestures.observe(element)
// add your event callback
wheelGestures.on('wheel', (wheelEventState) => {
//...
})
There are options to customize the behaviour.
This is the TypeScript type of the WheelEventState object provided. Even if you do not use TypeScript, this might be helpful to see how the data is provided:
export type VectorXYZ = [number, number, number]
export interface WheelEventState {
isStart: boolean
isMomentum: boolean
isEnding: boolean
isMomentumCancel: boolean
axisDelta: VectorXYZ
axisVelocity: VectorXYZ
axisMovement: VectorXYZ
axisMovementProjection: VectorXYZ
event: WheelEvent | WheelEventData
previous?: WheelEventState
}
Read more in the docs.
OS & Browsers
Other people also thought that it might be helpful for some interactions to be able to distinguish between user initiated wheel events and the ones that are triggered by inertia scroll, but none of the other known libraries delivered results in the precision I needed, so I developed my own solution. Honourable mentions:
FAQs
wheel gestures and momentum detection
The npm package wheel-gestures receives a total of 39,222 weekly downloads. As such, wheel-gestures popularity was classified as popular.
We found that wheel-gestures demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.