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

@johntalton/i2c-port

v1.0.0

Published

Provides tooling that allows for `I2CBus` to be hosted natively, over `MessagePort`, within `Worker` and over `WebSockets`.

Downloads

10

Readme

I²C MessagePort based Bus

Provides tooling that allows for I2CBus to be hosted natively, over MessagePort, within Worker and over WebSockets.

npm Version GitHub package.json version CI CodeQL GitHub Downloads Per Month GitHub last commit Package Quality

This allows the I2CBus api to be used in a wide range of deployment cases.

It can also be using with bus Multiplexing such as @johntalton/i2c-bus-tca9548a that adheres to the I2CBus interface. As well as using i2c-bus as the default concrete/base implementation.

Provided Abstraction

Key is providing multiple abstraction layers.

  • A Message type definition (including Read, ReadResult, Error, etc)
  • An I2CPort function that maps Message into I2CBus commands on provided bus
  • And I2CPortBus which implements I2CBus over a MessagePort interface

The corresponding WebSocket to MessagePort example can be run to provide this service.

The Message definition layer provides a naming convention and contract without implementation details. It is ideal for abstracting the service at each layer.

The Port utility layer allows for mapping of the generalized message into I2CBus interface commands. This layer provides the mirror binding the I2CPortBus implementation. This utility operates over an I2CBus interface, allowing for further abstraction and requires the caller to manager its allocation and state.

The Bus interface layer (along with example server) creates a WebSocket service which allows for the above Message interactions to a concrete - and remote - implementation. The I2CPortBus uses a simple one-call-one-response per MessagePort in order to bridge the WebSocket on/send api into the I2CBus more friendly Promisebased async/await code.

Direction

Having a full I2CWebBus that implements I2CBus enables moving other Sensor implementations that currently use the I2CBus over to a web-safe version. This will increase code portability and quality as wall as validate many of the timing and latency issues that are otherwise not seen locally in most cases.

Further mocking and virtualizing can be provided once a common WebSocket message api is established. Providing virtual sensor and other services in a web-centric fashion.

Single 1:1 calls allow for basic interactions, however, extending the message with 'scripting' style operation could provide performant solution when latency of the transit layer becomes and issue. This could be extended to enable service-side interactions such as keep alive or default access polling. Other common data-fetch or read-comp-trigger features could be added.