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

browser-wii-remote

v0.0.5

Published

Use experimental bluetooth and HID APIs to connect to wii remotes

Readme

Browser Wii Remote

Connect to a Wii Remote from the browser!

Support varies, check browser compatibility with HID and Web Bluetooth (optional, but simple) APIs. You will likely need to instruct users to toggle a flag in their browser. In Google Chrome on Ubuntu, I had to give access to /dev/hidraw.

Thanks to the team at Wiibrew for making this easier to implement. This also had some inspiration from GiiMote

Current Support

Checked boxes are supported, unchecked are in consideration

Feedback

  • [x] Rumble
  • [x] LEDs

Input

  • [x] Button data
  • [x] Accelerometer
  • [ ] IR
  • [ ] Extension Controllers
  • [ ] Flash memory storage
  • [ ] Sound

Misc

  • [x] Establishing a connection
  • [ ] Events on connect / disconnect / reconnect
  • [ ] Multiple connections at once (needs verification & scoping)

Connecting

  1. Import the default export and call it with a user gesture such as an onClick listener. You can skip this if the wii remote is already paired (first param as false)
  2. The promise from 1 should return a callback. This callback connects via the HID APIs and should also be in a user gesture.
  3. The promise above should return a WiiRemote object. You can use this to interact with the Wii Remote

Overall, it looks like this:


import EstablishWiiRemoteConnection from 'browser-wii-remote'

let remote = null

EstablishWiiRemoteConnection(showBluetoothDialog?: boolean, inputMode?: WiiRemoteReportModes)
.then(connectViaHID => connectViaHID()
.then(wiiRemote => remote = wiiRemote))

Of course, many things can go wrong, so error handling should be done. EstablishWIiRemoteConnection and connectViaHID need to be called on a user gesture (you will get an error).

Using the WiiRemote object

Rumble

setRumble(value: boolean)

Set the rumble on or off

LEDs

setLED(led: LEDS, active: boolean)

LEDS is an enum that can be imported

Report modes

setReportMode(mode: WiiRemoteReportModes)

Determine what data the Wii Remote will send.

Modes include (checked are implemented in this library)

  • [x] CORE_BUTTONS
  • [x] CORE_BUTTONS_AND_ACCEL
  • [ ] CORE_BUTTONS_AND_8_EXTENSION_BYTES
  • [ ] CORE_BUTTONS_ACCEL_IR
  • [ ] CORE_BUTTONS_AND_19_EXTENSION_BYTES
  • [ ] CORE_BUTTONS_ACCEL_16_EXTENSION_BYTES

Event Listeners

There are two types of listeners as of now. Buttons and Accelerometer.

Adding

addListener(
    event: WiiRemoteStateAccel | WiiRemoteStateKeys,
    callback: function({
            previous: boolean | number, // Previous state
            current: boolean | number, // Current state
        },
        {
        // Full current Wii Remote state, can be used for easy button combinations
        // Keys of the object are the total options of the event
        }
    )
)

Buttons are booleans and accelerometer events are numbers

Removing

removeListener(event: WiiRemoteStateAccel | WiiRemoteStateKeys, callback: AboveFunction)

You can also remove references of events