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

arena-redux

v3.1.3

Published

A Redux library for financial services.

Downloads

19

Readme

arena-redux

SETUP

npm i arena-redux

ACTIONS

environment

  1. initEnvironment

    initEnvironment(type = 'WINDOW_RESIZE')

    Prepares screen height and width, and prepares the resize function to update the variables on window.onresize. We usually fire this in the componentWillMount method of the root App component.

    Note: If you're using the Arena Redux environment reducer, then you can leave the default action type in place, as it's shared by the reducer.

    Example

    import {initEnvironment} from 'arena-redux'
    
    class Root extends Component {
      componentWillMount() {
        dispatch(initEnvironment())
      }
    }

form

  1. autofill

    autofill(formName, fields)

    Takes a form name and an object with key/value pairs mapped to fieldName: value.

    Example

    import {autofill} from 'arena-redux'
    
    const fields = {
      firstName: 'Ted',
      lastName: 'Cruz',
    }
    
    dispatch(autofill('MY_FORM', fields))

router

  1. navigateTo

    navigateTo(route, shouldPushState = true, type = 'CHANGE_ROUTE')

    Takes a route object, your action type, and a flag for the HTML5 history.pushState() method to update the browser URL. Since this is one of the actions used frequently and takes an action type, it's best to create an action wrapper.

    Note: If using the Arena Redux router reducer, you can leave the default action type.

    Example

    import {navigateTo as arenaNavigateTo} from 'arena-redux'
    
    export const navigateToStateless = (route, shouldPushState = false) => dispatch => {
      dispatch(arenaNavigateTo(route, shouldPushState))
    }
    import {navigateToStateless} from './actions'
    import * as paths from './paths'
    
    dispatch(navigateToStateless({
      keys: {},
      options: {},
      path: paths.HOME,
    }))
  2. navigateBack

    navigateBack(event, type = 'CHANGE_ROUTE')

    Takes an event object and an action type, and uses navigateTo to go to the previous URL. shouldPushState is passed as false.

    Example

    import {navigateBack as arenaNavigateBack} from 'arena-redux'
    
    export const navigateBack = e => dispatch => {
      dispatch(arenaNavigateBack(e))
    }
  3. initRouter

    initRouter(paths, type = 'CHANGE_ROUTE')

    Takes an array of strings (relative paths) and the action type you use for navigation. Like initEnvironment, this is fired once on the root component.

    Example

    import {initEnvironment, initRouter} from 'arena-redux'
    
    class Root extends Component {
      componentWillMount() {
        dispatch(initEnvironment(types.WINDOW_RESIZE))
        dispatch(initRouter(this.props.paths, 'CHANGE_ROUTE'))
      }
    }

    Note: There are more steps to set up routing, you need to also map each path to a container, and use a Router component to serve up the right one.

UTILS

router

| function | description | | ------------------------------------ | ---------------------------------------- | | compileOptions(options) | Maps the option keys and joins options with & | | compileHash(route) | Generates a URL hash with the path, keys, and options | | pushState(route) | Updates history.pushState() with compiled hash | | parseRouteKeys(pathString, result) | Parses the route keys using RegExp.exec() | | parseRouteOptions(options) | Splits the route option string and reduces an object | | parseRoute(hash, paths) | Uses the two parser functions to parse a route | | changeUrl(route) | Updates location.href | | getBaseUrl() | Gets protocol, host, and pathname from location |

api

| function | description | | -------- | ----------- | | | |