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

logi-gamepad-bridge

v0.1.2

Published

Bridge browser Gamepad API haptics to HapticWebPlugin (MX Master 4)

Downloads

418

Readme

logi-gamepad-bridge

Bridge the browser Gamepad Haptics API (GamepadHapticActuator) to HapticWebPlugin on Logitech MX Master 4.

Prerequisites

  1. Install HapticWebPlugin (Logi Options+ + MX Master 4).
  2. Ensure local.jmw.nz resolves to 127.0.0.1.
  3. Grant local network access in the browser when prompted.

Browser injection

Paste in the DevTools Console on any tab (patches navigator.getGamepads()):

document.head.appendChild(Object.assign(document.createElement('script'),{src:'https://unpkg.com/[email protected]/dist/inject.min.js'}))

A 404 plus nosniff in the console means the CDN returned an HTML error page (often 0.1.0, which has no inject bundle). Hard-refresh or pin the version above.

When you see Gamepad API patched, pick Logitech MX Master 4 (HapticWeb Bridge) if the site lists gamepads, then use its vibration/rumble controls. If it does not show up, refresh and run the line again before the page reads gamepads.

Install (npm)

npm install logi-gamepad-bridge

Test UI

git clone https://github.com/humbertogontijo/logi-gamepad-bridge.git
cd logi-gamepad-bridge
npm install
npm run dev

Opens http://localhost:5173 — click Connect (HapticWebPlugin must be running).

Build

npm install
npm run build

Produces dist/index.js (library) and dist/inject.min.js (browser injection bundle).

Usage

import { connectLogiGamepad } from 'logi-gamepad-bridge';

const bridge = connectLogiGamepad({
  patchGetGamepads: true,
});

window.addEventListener('gamepadconnected', (e) => {
  const actuator = e.gamepad.vibrationActuator;
  if (!actuator) return;

  void actuator.playEffect('dual-rumble', {
    duration: 300,
    strongMagnitude: 0.9,
    weakMagnitude: 0.4,
  });
});

Direct actuator

import { LogiGamepadBridge } from 'logi-gamepad-bridge';

const bridge = new LogiGamepadBridge();
bridge.connect();

void bridge.actuator.pulse(0.8, 200);

How it works

| Gamepad API | Bridge | HapticWebPlugin | | ----------------------------------- | --------------------------------------------- | ------------------------------ | | playEffect('dual-rumble', params) | Maps magnitude/duration → waveform index 0–14 | ws.send(Uint8Array([index])) | | pulse(value, duration) | Same mapper | WebSocket | | reset() | Clears pending delayed effects | — |

The MX Master 4 only supports 15 fixed waveforms, not continuous rumble. Intensity is capped by Logi Options+ haptic strength.

API

  • LogiGamepadBridge — WebSocket client + actuator + optional synthetic Gamepad
  • LogiHapticActuatorGamepadHapticActuator implementation
  • HapticWebClient — low-level HapticWeb WebSocket client
  • mapEffectToWaveformIndex / mapPulseToWaveformIndex
  • connectLogiGamepad() / getLogiGamepadBridge()

License

MIT