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

term-mouse

v0.2.2

Published

Originally based on [TooTallNate's gist](https://gist.github.com/1702813), rewritten to use all the mouse reporting modes.

Downloads

422

Readme

Term Mouse

A mouse reporting interface

Originally based on TooTallNate's gist, rewritten to use all the mouse reporting modes.

Example

var mouse = require('term-mouse')();

mouse
	.start()
	.on('click', function(e) {
		console.log('you clicked %d,%d with the %s mouse button', e.x, e.y, e.button /* 'left', 'middle' or 'right' */);
	})
	.on('scroll', function(e) {
		console.log('you scrolled %s', e.button /* 'up' or 'down' */);
	});

API

var mouse = require('term-mouse')(options);

Options:

  • input - the stream to read events from, defaults to process.stdin
  • output - the stream to write control codes to, defaults to process.stdout
  • utf8 - whether to use UTF-8 (1005) reporting mode, this could break things if your terminal only supports the standard reporting mode or if you're using a non-UTF-8 locale

Events:

  • event - move, buttons and scroll
  • move
  • buttons - when a button is pressed or released
  • scroll
  • up - when a button is pressed
  • down - when a button is released
  • click - up after down, here there are two event objects passed: the first is from when the button was pressed, the second is from the button being released

All of these include an event object:

  • shift - whether the shift key is down
  • meta - whether the meta (alt) key is down
  • ctrl - whether the control key is down
  • name - 'scroll', 'move' or 'buttons'
  • button - 'left', 'middle', 'right' or 'none' if the button is released
  • btnNum - the button that was pressed / released, if it's not using xterm's ASCII reporting mode then it'll be null when the button is released
  • down - if the button is down
  • x - the x coordinate of the cursor
  • y - the y coordinate of the cursor
  • sequence - the string that caused this event (if it's using the standard reporting mode, this could be incorrect because the real sequence is invalid UTF-8)
  • buf - the sequence that caused this event as a buffer

Useful References

I looked at http://invisible-island.net/xterm/ctlseqs/ctlseqs.html and https://www.systutorials.com/docs/linux/man/7-urxvt/ while making this.