herux
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

Herux

Build Status codecov

We look for Flux, Redux and Fluxible and want to take the best parts of them.

We like functional programming, but we like OOP more.

See examples

Main points

  • actions are simple objects with type and data
  • use Context for all operations (actions dispatching, get stores, change listening)
  • keep your data in many dedicated stores
  • you can use static stores (like 'Users') or dynamic stores (like 'Group1', 'Group2' and etc)

Static store

class StaticStore {
    /* some class body */
}

StaticStore.storeType = 'static';
StaticStore.storeName = 'name';
StaticStore.handlers = [
    {
        method: 'methodName',
        type: 'ACTION_TYPE'
    }
];

Dynamic store

class DynamicStore {
    /* some class body */
}

DynamicStore.storeType = 'dynamic';
DynamicStore.storePattern = /^Group\d+$/;
DynamicStore.handlers = [
    {
        method: 'methodName',
        selector: (data) => 'Group' + data.groupId,
        type: 'ACTION_TYPE'
    }
]

Context

  • dispatch(action: Action): void
  • getStore(name: String): Store
  • listen(stores: String[], cb: (stores: Store[]) => void): void

Readme

Keywords

Package Sidebar

Install

npm i herux

Weekly Downloads

13

Version

0.4.0

License

MIT

Last publish

Collaborators

  • arusakov