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

react-causality-redux

v2.2.3

Published

Causality based extension of react-redux

Downloads

11

Readme

Installation

npm install --save react-causality-redux

Basics

establishControllerConnections - Connects store partition keys and functions to a react component in the props. Whenever any of the store partition values change, the react component re-renders with the new values put into the props by causality-redux. Syntax

establishControllerConnections(obj)

Parameters

  • obj.module{Object}[Optional] - The variable module in the calling module. Used to support hot re-loading..
  • obj.partition{Object}[Optional] - The causality redux partition definition.
  • obj.uiComponent{Object}[Optional] - A react component to be wrapped with redux connect.
  • obj.uiComponentName{String}[Optional but required if obj.uiComponent is specified] - The string name of the component, such as Todo is simply 'Todo'.
  • obj.storeKeys{Array}[Optional] - The default behavior connects all keys in the defaultState of the partition to the react uiComponent. Override this behavior by supplying a subset of defaultState keys in an array with this key.
  • obj.changerKeys{Array }[Optional] - The default behavior connects all keys in the controllerFunctions of the partition to the react uiComponent. Override this behavior by supplying a subset of the uiServiceFunctions keys in an array with this key.
  • obj.hotDisposeHandler{Function}[Optional] - A function that is to be called just before the module is hot reloaded. Generally use this to remove event listeners or other side effects of loading the module.
  • obj.controllerUIConnections{Array}[Optional] - This parameter is used for two reasons. One, you want to connect a component in the view to other component partitions or two, you want to connect multiple conponents in the view to obj.partition or other component partitions. Either way this parameter is an array of objects. Note, if a partition is defined on input then each redux connected component will be contained in the partition store under its string componentname below. The format of each array entry in controllerUIConnections array is given below.

Array Parameter Format 1 - For connecting to one partition to one a component in the view.

{
    uiComponent{Object} - The component to be wrapped.
    partitionName{string} - The partition from which to connect to.
    changerKeys{Array} - array of partition uiServiceFunction function keys to receive in the props of the component. If this entry is undefined then all uiServiceFunction keys are included in the props. If this entry is an empty array then no uiServiceFunction keys are included in the props.
    storeKeys{Array} - array of partition store keys to receive in the props of the component. If this entry is undefined then all defaultState keys are included in the props. If this entry is an empty array then no defaultState keys are included in the props.
    uiComponentName{String} - The string name of the component.
}

Array Parameter Format 2 - For connecting multiple partitions to a component in the view. In short, you can connect state and/or functions from other components.


{
    uiComponent{Object} - The component to be wrapped
    partitions: - The partitions you want to connect to.
    [
        { partitionName{String}, changerKeys{Array}, storeKeys{Array} }
    ],
    uiComponentName{String} - The string name of the component.
}

As above, for the partitions array argument, if the changerKeys is undefined then all uiServiceFunction keys for the partition are included in the props and if changerKeys=[] then no uiServiceFunction keys for the partition are included in the props. Likewise, if the storeKeys is undefined then all defaultState keys for the partition are included in the props and if storeKeys=[] then no defaultState keys for the partition are included in the props.

Return Value

{ partitionState, setState, getState, subscribe, partitionStore, uiComponent }
  • partitionState - A proxy to the store partition keys so that you can get and set individual partition keys. The statement partitionState.key returns a shallow copy of key and partitionState.key = value sets key to value in the redux partition according o===to the rules of redux updating.
  • setState(obj) - Merges obj with the redux partition object.
  • getState - Gets the entire partition object.
  • subscribe(listener{function}, keys{array}) - The listener is called if and only if any of the keys in the array argument are changed in the redux partition. The listener will receives an object that contains the key/value pairs of those that changed.
  • partitionStore - Returns the partition's store object. This object contains the below.
    1. partitionState
    2. setState
    3. getState
    4. subscribe
    5. uiServiceFunctions at their respective key from the uiServiceFunctions object.
  • uiComponent
    1. The redux connected component if uiComponent is valid on input.
    2. If controllerUIConnections.length === 1 then uiComponent is an object of the redux connected component(s).
    3. If controllerUIConnections.length > 1 then uiComponent is undefined and the redux connected components are stored in the redux partition with keys of their componentname.