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

app-conductor

v1.0.6

Published

Generalized JavaScript implementation of an app conductor for the conductor pattern. Can be used with React apps, as well as other type of JS apps.

Downloads

1

Readme

This is as private-ish ALPHA stage package (meaning no guarantee it will work), which is a conductor pattern implementation for javascript apps. Can be used with React and other frameworks.

In a component based architecture, many feel that components should ONLY handle events - "NON prospective-cross-cutting events" - that are strickly within their boundries and strickly within their concern. All other events should be handled at the app level. Wouldn't it be nice if there was have a generalized implementation to provide for this?

...There is: App Conductor.

Components execute notify to notify the App Conductor of prospective cross-cutting events via a notice (a pojo), which must have a "TITLE" key.

Note for the reading ahead, App Conductor has a setup function addNoticeMgtDependencies(handlers, dispatch, getState) for injecting in closure dependencies for the conductor.

The App Conductor handles notice, which are simple POJOs.

Notices are meant to convey information about a) events in the view - or from anywhere in the app, or b) requests for action.

Notices about events should have this general structure: {TITLE: "Unique PAST-TENSED snake case title about what happend" (it should only describe what happened, not what should be done!), O there optional properties about the details of the event and its context.

Notices for requests have the same structure but the TITLE property is instructive, for example "Yada_Is_Reqested". Note, the idea of "requested" and not "demanded" is a key idea of the conductor pattern. Just like a symphony orchestra, players never demand anything from the conductor!

Notices are sent to the App Conductor from the view or wherever in the app by the function notifyAC(notice)

The App Conductor handles these notices by delegating them to injected notice handlers typically named after notice titles.

Notice handlers are called with the notice and an "accessories" object, which can be set with whatever properties you want on initialization, for example Redux's dispatch and getState functions. Furthermore the notifyAC function is added to accessories. Hence notice hander's should have a declaration like this: function some_handler_named_after_a_notice_title(notice, ac) {...}. Note "ac" here is short for accessories (and also app-conductor).

These handlers can do anything - yep even side-effects. One common chore - if one is using a Redux store - is to build an action (a pojo) which can then be dispatched to the the Redux store's reducers.

Redux users typically conventional redux patterns and middleware such as redux-thunk or redux-saga, and nothing wrong with that, but it's felt that the App-Conductor with handlers provides for an extremely flexible, generalized and non-vendor approach to handling events that lead to state changes and app level activity, since it doesn't conflate an event management/handling solution with a store-state mgt solution.

Note, handlers can also (recursively) call notify as part of their handling logic.

For React app developers, the file withAppConductorHOC_example.js shows an implementation of creating an higher-order-component for isomorphically tieing in your App component (or the like) to the App Conductor system.