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

webmonome

v0.0.1-alpha.8

Published

communicate with devices beyond a translator

Downloads

22

Readme

WebMonome

| | | |---|---| | npm | 0.0.1-alpha.8 | | size | 1.96kb minzipped | | dependencies | zero | | license | MIT |

communicate with devices beyond a translator

webmonome is a little library designed to enable communication with monome devices directly from the web browser (bypassing serialosc). while serialosc is the best choice 99% of the time, i thought that it might be nice to enable the creation of monome apps that required zero install/config.

usage

script include

<script src="https://unpkg.com/webmonome@alpha"></script>
const monome = new WebMonome();

const btn = document.createElement('button');
btn.innerHTML = 'connect';
btn.addEventListener('click', () => {
  monome.connect();
});
document.body.appendChild(btn);

const keydown = e => {
  monome.gridLed(e.x, e.y, true);
};

const keyup = e => {
  monome.gridLed(e.x, e.y);
};

monome.on('gridKeyDown', keydown);
monome.on('gridKeyUp', keyup);

import

npm install webmonome@alpha

import WebMonome from 'webmonome';

const monome = new WebMonome();

const btn = document.createElement('button');
btn.innerHTML = 'connect';
btn.addEventListener('click', () => {
  monome.connect();
});
document.body.appendChild(btn);

const keydown = e => {
  monome.gridLed(e.x, e.y, true);
};

const keyup = e => {
  monome.gridLed(e.x, e.y);
};

monome.on('gridKeyDown', keydown);
monome.on('gridKeyUp', keyup);

requirements

webmonome relies on the WebUSB api. information on browser support for the WebUSB api can be found over at caniuse.

webmonome also requires that serialosc is disabled. On macOS open Terminal and execute:

launchctl unload /Library/LaunchAgents/org.monome.serialosc.plist

To re-enable:

launchctl load /Library/LaunchAgents/org.monome.serialosc.plist

api

webmonome is currently very bare bones (as i'm still working out the kinks with WebUSB and the monome serial protocol), but there is enough there to perform most grid operations.

connect

  • initialize WebUSB and connect to device:

    monome.connect()

system

system responses come in the form of events (see below), but this may be changed to include a callback or promise for ergonomics.

  • request device information:

    monome.query()
  • request device id:

    monome.getId()
  • request grid size:

    monome.getGridSize()

grid ops

  • set a single LED on or off:

    monome.gridLed(xCoord, yCoord, on)
    • xCoord: integer
    • yCoord: integer
    • on: boolean
  • set all LEDs on or off:

    monome.gridLedAll(on)
    • on: boolean
  • set on/off state for column of LEDs:

    monome.gridLedCol(xOffset, yOffset, state)
    • xOffset: integer
    • yOffset: integer (floored to multiples of 8 by the device firmware)
    • state: array of up to 8 0/1 bits
  • set on/off state for row of LEDs:

    monome.gridLedRow(xOffset, yOffset, state)
    • xOffset: integer (floored to multiples of 8 by the device firmware)
    • yOffset: integer
    • state: array of up to 8 0/1 bits
  • set on/off state for an 8x8 quad of LEDs:

    monome.gridLedMap(xOffset, yOffset, state)

    xOffset: integer yOffset: integer state: array of up to 64 0/1 bits

  • set system wide grid intensity:

    monome.gridLedIntensity(intensity)
    • intensity: integer (0-15)
  • set single LED to specific level:

    monome.gridLedLevel(xCoord, yCoord, level)
    • xCoord: integer
    • yCoord: integer
    • level: integer (0-15)
  • set all LEDs to specific level:

    monome.gridLedLevelAll(level)
    • level: integer (0-15)
  • set level state for column of LEDs:

    monome.gridLedLevelCol(num: xOffset, num: yOffset, []num: state)
    • xOffset: integer
    • yOffset: integer (floored to multiples of 8 by the device firmware)
    • state: array of up to 8 integers (0-15)
  • set level state for row of LEDs:

    monome.gridLedLevelRow(num: xOffset, num: yOffset, []num: state)
    • xOffset: integer (floored to multiples of 8 by the device firmware)
    • yOffset: integer
    • state: array of up to 8 integers (0-15)
  • set level state for an 8x8 quad of LEDs:

    monome.gridLedLevelMap(num: xOffset, num: yOffset, []num: state)
    • xOffset: integer
    • yOffset: integer
    • state: array of up to 64 integers (0-15)

event system

  • subscribe to events:

    monome.addEventListener(eventName, callback)
    • eventName: string
    • callback: function
  • unsubscribe from events:

    monome.removeEventListener(eventName, callback)
    • eventName: string
    • callback: function

events

  • query {type: num, count: num}
  • getId str
  • getGridSize {x: num, y: num}
  • gridKeyDown {x: num, y: num}
  • gridKeyUp {x: num, y: num}

next steps

  • remaining /sys/ commands
    • grid offsets
    • addr scan
    • firmware version
  • arc ops
  • add any additional ops in the monome serial protocol (reaching something similar to libmonome)

see also