Coder Social home page Coder Social logo

substate's People

Contributors

dependabot[bot] avatar lsmoura avatar tamb avatar tomsaporitoxo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

substate's Issues

TASK - update documentation

  • beforeUpdate & afterUpdate need to show defined params and should be explained
  • show demo of async action
  • link to substate demo
  • explain pubsub portion of this "message bus"

Optional Dev Logs -

Optional configs only for dev mode that will give helpful clues. Emit $type and use colors like:
console.log('%c Oh my heavens! ', 'background: #222; color: #bada55');

This way you can track your messages
Eventually a library should be made

Perhaps this config also allows you to add your store to the window object

Support for Redux methods

Would be good to add async support through:
dispatch
commit

I can implement those methods to call emit under the hood.

We should implement this without breaking the current API.

__

the reasoning behind this is to support the goal of universal terminology in application state management. Sure it's a more convoluted pub/sub. But it should help teams to get on the same page.

Better Docs - Patterns

Show patterns of use:

substate action with payload describing new state 
    --> (state cloning magic) 
            --> callback(s) w/ new state

substate action with payload 
     --> reused logic to consume this action and describe new state 
            --> (state cloning magic) 
                   --> callback(s) w/ new state

infinite actions, infinite data changes, infinite responses

A happens --> do B --> yields C for those who care

ABCD happens --> do E --> yields F for those who care

A happens --> do B2 --> yields C2 for those who care

ABCD happens --> do E2 --> yields F2 for those who care

etc...

WIP - registerMutations, registerActions, registerEvents methods

maybe just suggest encapsulating Actions and Event names within store?

store.register[x]()

store.registerMutations(Function | [Functions])
A mutation should return an object as new state,
This changes the call signature of emit

emit(String, {Function | Object})


store.registerActions

Tests for middleware

I need to write tests for the middleware functionality to make sure that the functions are fired in the right order.

accept emitting, updated middleware in options

When you emit('UPDATE_STATE', {} ), there should be a config option for middleware to access the entire state management instance.

Right before STATE_UPDATED or a custom action is returned, there should option for middleware to fire. So it's a method that fires on EVERY state update.

This will allow for client side storage to be added, and other features.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.