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

cycle-gear

v7.5.0

Published

Main function factory for CycleJS

Downloads

78

Readme

cycle-gear

cycle-gear is a formalization of the CycleJS MVI pattern and a main function factory (pedal) to make use of the pattern.

Why Formalize?

Cycle's documentation on the CycleJS MVI pattern makes it clear that Cycle's goal is not to formalize the MVI pattern into the framework.

Formalizing an architecture pattern, however, can provide a common component platform and organization scheme to a project. cycle-gear is one approach to componentizing the pieces of a CycleJS main component into a form encouraging separation of concerns, and easy reuse of the component parts.

The Pattern

Gear Analogy

A Gear consists of an intent, model, and a set of teeth comprising of a filter and a view.

The intent responds to the changes from the gear's sources, converting them into actions for a model to respond to.

The model takes the actions of the gear's intent and produces a single observable of model states.

A tooth produces output to a gear's sinks by filtering the gear's model states and presenting them through a view.

The catch will handle the gear's model errors. While this could be manually done for each gear model, as a top level part of a gear it encourages the ability to handle errors systematically, such as how each tooth might deal with it. (It also allows for a catch to be defaulted across a transmission, helping avoid issues with a "stuck" transmission.)

pedal

pedal is a main factory function for the Gear pattern. It takes a transmission of Gears, default states for gears, which teeth to bind to which sinks, and from that builds a Cycle main to wire the gears up to Cycle sources and sinks.

A transmission is an observable of gears or a factory from Cycle sources to an observable of gears. At the top level of an application might be a transmission defined by a history router such as @cycle/history, and at lower levels a transmission might be some other sort of user-action dependent state machine.

motor

motor is a main factory function for the Gear pattern. It takes a gearbox of Gears, default states for gears, which teeth to bind to which sinks, connectors to merge the output of gears, and from that builds a Cycle main to wire the gears up to Cycle sources and sinks.

A gearbox is an observable of iterable sets of gears or a factory from Cycle sources to an observable of iterable sets of gears. This can be useful for component systems that have many similar, interlocking parts.