npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jworkshop/mouse

v0.0.6

Published

An instance class which hooks into all mouse and touch events.

Downloads

1

Readme

mouse

An instance class which hooks into all mouse and touch events. It also captures position, direction and speed of movement.

NPM version build status node version npm download

install

NPM

Usage

import Mouse from "@jworkshop/mouse";

/* Get the container for the mouse. */
var container = document.getElementById("container");

/* Create a mouse instance, with the element as its container.
 * This is to allow the mouse to monitor all mouse events from the container. */
var mouse = new Mouse(container);

/** Append the mouse to the a DOM element and event functions to it. */
mouse.attach(container);

/** Disengage the mouse from DOM element and event functions from it. */
mouse.detach();

/** Toggle value for mouse prevent default on all events. */
mouse.setPreventDefault(preventDefault);

let mouseOverHandler = event => { ... };

/** Bind an event handler to the mouse over event. */
mouse.onMouseOver(mouseOverHandler);

/** Unbind an event handler to the mouse over event. */
mouse.removeMouseOver(mouseOverHandler);

/** Unbind all event handlers from the mouse over event. */
mouse.clearMouseOver();

let mouseOutHandler = event => { ... };

/** Bind an event handler to the mouse out event. */
mouse.onMouseOut(mouseOutHandler);

/** Unbind an event handler to the mouse out event. */
mouse.removeMouseOut(mouseOutHandler);

/** Unbind all event handlers from the mouse out event. */
mouse.clearMouseOut();

let mouseDownHandler = event => { ... };

/** Bind an event handler to the mouse down event. */
mouse.onMouseDown(mouseDownHandler);

/** Unbind an event handler to the mouse down event. */
mouse.removeMouseDown(mouseDownHandler);

/** Unbind all event handlers from the mouse down event. */
mouse.clearMouseDown();

let mouseUpHandler = event => { ... };

/** Bind an event handler to the mouse up event. */
mouse.onMouseUp(mouseUpHandler);

/** Unbind an event handler to the mouse up event. */
mouse.removeMouseUp(mouseUpHandler);

/** Unbind all event handlers from the mouse up event. */
mouse.clearMouseUp();

let mouseMoveHandler = event => { ... };

/** Bind an event handler to the mouse move event. */
mouse.onMouseMove(mouseMoveHandler);

/** Unbind an event handler to the mouse move event. */
mouse.removeMouseMove(mouseMoveHandler);

/** Unbind all event handlers from the mouse move event. */
mouse.clearMouseMove();

let mouseScrollHandler = event => { ... };

/** Bind an event handler to the scroll event. */
mouse.onScroll(mouseScrollHandler);

/** Unbind an event handler to the scroll event. */
mouse.removeScroll(mouseScrollHandler);

/** Unbind all event handlers from the mouse scroll event. */
mouse.clearScroll();

let dragHandler = event => { ... };

/** Bind an event handler to the drag event. */
mouse.onDrag(dragHandler);

/** Unbind an event handler to the drag event. */
mouse.removeDrag(dragHandler);

/** Unbind all event handlers from the mouse drag event. */
mouse.clearDrag();

let dragOverHandler = event => { ... };

/** Bind an event handler to the drag over event. */
mouse.onDragOver(dragOverHandler);

/** Unbind an event handler to the drag over event. */
mouse.removeDragOver(dragOverHandler);

/** Unbind all event handlers from the drag over event. */
mouse.clearDragOver();

let dropHandler = event => { ... };

/** Bind an event handler to the drop event. */
mouse.onDrop(dropHandler);

/** Unbind an event handler to the drop event. */
mouse.removeDrop(dropHandler);

/** Unbind all event handlers from the drop event. */
mouse.clearDrop();

let stopHandler = event => { ... };

/** Bind all event handlers from the stop event. */
mouse.onStop(stopHandler);

/** Unbind an event handler to the stop event. */
mouse.removeStop(stopHandler);

/** Unbind all event handlers from the stop event. */
mouse.clearStop();

let clickHandler = event => { ... };

/** Bind all event handlers from the click event. */
mouse.onClick(clickHandler);

/** Unbind an event handler to the click event. */
mouse.removeClick(clickHandler);

/** Unbind all event handlers from the click event. */
mouse.clearClick();