vigetlabs / microcosm

Flux with actions at center stage. Write optimistic updates, cancel requests, and track changes with ease.
http://code.viget.com/microcosm/
MIT License
487 stars 22 forks source link

Add subscribe method to action to abbreviate addons #408

Closed nhunzaker closed 7 years ago

nhunzaker commented 7 years ago

This PR adds a new subscribe method for quickly adding a bunch of action callbacks. Long term, this moves actions closer to the Observable interface, but it also cleans up the action form and button pretty nicely.

I also added some tests to gain some missing coverage.

codecov-io commented 7 years ago

Codecov Report

Merging #408 into scheduled-model will decrease coverage by 1.23%. The diff coverage is 100%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           scheduled-model     #408      +/-   ##
===================================================
- Coverage            87.32%   86.08%   -1.24%     
===================================================
  Files                   45       45              
  Lines                 1270     1301      +31     
  Branches               232      244      +12     
===================================================
+ Hits                  1109     1120      +11     
- Misses                 135      147      +12     
- Partials                26       34       +8
Impacted Files Coverage Δ
packages/microcosm-preact/src/action-button.js 100% <100%> (ø) :arrow_up:
packages/microcosm/src/action.js 100% <100%> (ø) :arrow_up:
packages/microcosm/src/addons/action-form.js 78.04% <100%> (-21.96%) :arrow_down:
packages/microcosm/src/addons/action-button.js 77.77% <100%> (-22.23%) :arrow_down:
packages/microcosm-preact/src/action-form.js 100% <100%> (ø) :arrow_up:
packages/microcosm/src/addons/indexing.js 92.68% <0%> (-7.32%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 700734c...6fdf63f. Read the comment docs.