Skip to content

processprocess/mouse-speed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mouse-speed

Calculates mouse speed during the mousemove event.

NPM

Usage

var MouseSpeed = require("mouse-speed");
var speed = new MouseSpeed();
speed.init(onCalcSpeed);

var onCalcSpeed = function() {
    var speedX = speed.speedX;
    var speedY = speed.speedY;
    // do anything you want with speed values
    console.log(speedX, speedY);
};

Create a new instance of mouse-speed in your project.

The speed values are accessed through the speedX and speedY properties on the instance.

The function passed to the instance will fire on every mousemove event.

speed.destroy(onDestroyFunc);

var onDestroyFunc = function() {
    console.log("destroyed");
};

To remove the event listener, call destroy on the instance of mouse-speed.

An optional function can be passed that will be called when the event listener is removed

License

MIT, see LICENSE.md for details.

About

A node module to calculate mouse speed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors