pyx

0.2.0 • Public • Published

Pyx - a Flux implementation

Synopsis

const Pyx = require('pyx')

class SimpleStore extends Pyx {
  constructor() {
    super()
    this.status = '' // or call this._resetProps()
  }

  _resetProps() {
    this.status = ''
  }

  props() {
    return [ 'status' ]
  }
}

At this point, all functionality in Pyx is complete. You may also override other methods such as _resetStores if you need to do something different instead of just calling .reset() on all sub-stores. e.g. if you don't want to reset a specific sub-store.

You may also override reset, extract and restore if you need to do something different with these too.

Why this Flux Implementation?

The main reason I like using this is because each store and sub-store knows exactly what it is doing. There is no indirection between event dispatch and the store - just call the event on the store itself.

It also help in being able to get sub-stores from top-level stores and pass those on to each React component individually instead of having to pass the entire store down. I have found that many times, a component and a store go hand-in-hand and then sub-stores and sub-components do the same.

Author

Andrew Chilton.

License

ISC.

Readme

Keywords

none

Package Sidebar

Install

npm i pyx

Weekly Downloads

1

Version

0.2.0

License

ISC

Last publish

Collaborators

  • chilts