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 🙏

© 2026 – Pkg Stats / Ryan Hefner

osx-mouse-napi

v1.0.1

Published

Mouse tracking for OS X

Readme

osx-mouse-napi

Mouse tracking for macOS. Receive the screen position of mouse events, including while another application is in the foreground. Events are observed only and are not consumed.

Requires macOS 10.15 or later and Node.js 16 or later. The native addon is built with Node-API (node-addon-api) and also uses libuv, so npm install compiles it for the Node.js version you are running. Xcode command line tools are required.

npm i osx-mouse-napi

Usage

The module returns an event emitter instance.

var mouse = require('osx-mouse')()

mouse.on('move', function(x, y) {
	console.log(x, y)
})

The program will not terminate as long as a mouse listener is active. To allow the program to exit, either call mouse.unref (works as unref/ref on a TCP server) or mouse.destroy().

The events emitted are: move, left-down, left-up, left-drag, right-down, right-up, and right-drag. For each event the screen coordinates are passed to the handler function.

Limitations

From macOS Mojave and forward, mouse events are only delivered after the process is allowed under Accessibility (辅助功能). Input Monitoring is not required.

When running from Terminal:

  1. Open System Settings > Privacy & Security > Accessibility
  2. Add Terminal (or the app that launches Node) to the list and turn it on

On macOS Catalina and earlier, the same list is under System Preferences > Security & Privacy > Privacy > Accessibility. Restart the process after changing the permission.