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

rxkit

v0.1.8

Published

A lightweight, no dependency component kit for reactive programming

Downloads

11

Readme

rxkit

A lightweight, no dependency component kit for reactive programming

Basic concept

The fundamental mechanism is Feeders feeding to Feedable targets. A Feedable can be fed with any number of data for as long as needed. For every feed operation, Feedables return a Promise which resolves if the feed was successful or rejects if it was not.

A feeding session in which a Feeder feeds a Feedable is a PushStream.

Feedables

The reactive push concept demands that Feedables have no control over the feed they get. If they receive a feed, they act on it, and indicate the results in the Promise they return on the feed. They have the ability to indicate whether the feed did or did not succeed for whatsoever reason, but it is always the responsibility of the Feeder and the reactive upstream chain to handle rejections properly. The reactive concept also demands that Feedables do not maintain a reference of their feeders. They do not 'subscribe' to data feeds and cannot 'unsubscribe' from them as in event emitter/listener mechanisms. They can, however, backpressure the upstream chain by rejecting, slow-resolving, or slow-rejecting feeds. But then again, it is at the upchain's discretion, what to do with backpressures.

Feeders

Feeders act as data pushing agents. Since Feedables are passive receivers, Feeders are responsible for setting up feeding sessions. Here is an exmaple how a feeder sets up a feed:

const stream = new IntervalFeeder({ interval: 5000 }).feeds(feedable);

The PushStream

Everytime a Feeder starts a new feed, it creates a PushStream session. Once setup there are a number of ways the stream behavior can be manipulated with the following properties and methods:

  • enabled: the feed mechanism implemented in Feeders checks for this property. If set to false, the PushStream is considered to be paused and no more data will be fed until set to true again.
  • resume: a callback function, which is called when a PushStream enabled state is set to true from false
  • trigger: some feeders create push streams which are triggerable, which means that they only feed when they receive a trigger pulse. Technically, the trigger pulse is a Feedable endpoint to which others can feed the trigger the stream
  • throwsTo(target): Set up an alternate Feedable for redirecting feeds that have been rejected by the primary Feedable

In this exmaple the alternate feedable2 gets every item that feedable1 rejected:

const stream = new IntervalFeeder().feeds(feedable1).throwsTo(feedable2);

Transmitters

Transmitters are special agents which implement both feeder and feedable behaviors. They usualy implement special arrangements how they feed forward the data they receive: they transform or reduce it, queue up and temporarily hold it, or implement QoS/backpressure mechanisms.

Pipes

A Pipe is a chain of items where each item feeds the next one in the chain. For this reason, every member implements both Feeder and Consumer behaviors. In other words, each member of a pipe is a Transmitter. The Pipe is a powerful structure which can be built and extended in a chained programming style.

Pipes are partly immutable in a way, that they only hold reference to the last item in the queue, and to the PushStream which feeds to it. Even though Pipes can be extended by adding items at the end, this extension is achieved by creating a new pipe with the new member as last in queue.