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

@lfgf/cube-helper-web

v0.1.4

Published

Web Bluetooth helper for GAN smart cubes (moves stream)

Readme

cube-helper-web

This library was created as part of a personal experiment with smart cubes and Web Bluetooth.

A small, focused helper library that connects a GAN smart cube via Web Bluetooth and exposes cube movements as simple, semantic events.

This library intentionally abstracts away Bluetooth, encryption and device-specific protocols, allowing applications to consume cube moves (R, U', F2, etc.) with a minimal and stable API.


✨ Motivation

Working directly with smart cubes in the browser is harder than it should be.

Even with existing low-level libraries, applications still need to deal with:

  • Web Bluetooth APIs
  • RxJS event streams
  • Device-specific event formats
  • Noise and connection lifecycle

This project exists to separate concerns:

Device & protocol complexity → library
Application logic → consumer


🧩 What this library does

  • Connects to a GAN smart cube using Web Bluetooth
  • Listens to cube movement events
  • Emits normalized cube moves (R, U', F2)
  • Exposes a small, framework-agnostic API

❌ What this library does NOT do

  • No UI
  • No DOM access
  • No game logic
  • No cube state solving
  • No Bluetooth abstractions for non-GAN devices

This is a thin, intentional adapter, not a full cube SDK.


🚀 Installation

npm install @lfgf/cube-helper-web

Requires a browser with Web Bluetooth support (Chrome / Edge, HTTPS or localhost).


🛠️ Usage

import { connectGanCubeMoves } from "@lfgf/cube-helper-web";

const cube = await connectGanCubeMoves();

const unsubscribe = cube.onMove(({ move }) => {
  console.log("Cube move:", move);
});

// later
await cube.disconnect();

🧠 API connectGanCubeMoves(): Promise

Returns a connection object with:

type CubeConnection = {
  onMove(cb: (m: { move: string; ts: number }) => void): () => void;
  disconnect(): Promise<void>;
};

⚠️ Browser requirements

  • Chrome or Edge (Chromium)
  • User must explicitly allow Bluetooth access
  • Device selection is user-driven (browser security model)

🔧 Internals

Internally, this library wraps gan-web-bluetooth, translating low-level BLE/RxJS events into a stable, callback-based API.

This design allows applications to remain decoupled from:

  • Bluetooth APIs
  • RxJS
  • Device-specific event shapes

📦 Use cases

  • Cube training or analytics tools
  • Creative or experimental browser-based projects
  • Rapid prototyping with physical input devices

📄 License

MIT