angular-redux / ng-redux

Angular bindings for Redux
MIT License
1.16k stars 177 forks source link

feat(lib): provide store functionality #185

Closed AntJanus closed 6 years ago

AntJanus commented 6 years ago

Ref: https://github.com/angular-redux/ng-redux/issues/19

@deini would love some input on this. Here's the idea:

  1. when you dispatch, dispatch goes through the provided store. The provided store does its magic and triggers all of its subscribers (Angular and non-Angular)
  2. ng-redux creates an "empty" store which has a pass-through reducer (state => state)
  3. ng-redux subscribes to the provided store and on state update, dispatches the entire state to the "empty" store
  4. ng-redux users subscribe to the "empty" store and get notified as usual of any and all changes.

I haven't tested this out yet.

AntJanus commented 6 years ago

@derrickpelletier thanks for all the feedback! I'll have to get back to this once I get a chance. If you want to take over the branch and push the fixes you've got, you're more than welcome to.

derrickpelletier commented 6 years ago

Happy to, will push something soon.

derrickpelletier commented 6 years ago

@AntJanus how would you suggest going about it? I branched off yours, can PR into your branch or just re-submit the PR?

AntJanus commented 6 years ago

@derrickpelletier resubmit it and I'll just close this one out. Thanks for the hard work! :)