ryardley / ts-bus

A lightweight JavaScript/TypeScript event bus to help manage your application architecture.
MIT License
137 stars 8 forks source link

useBusState subscriber option #36

Closed dmicic closed 5 years ago

dmicic commented 5 years ago

useBusState implementation of #35. @ryardley the dispatch is slightly different compared to useBusReducer. It dispatches only the payload of the event. Reason is because I think for useBusState, only the payload is/should be relevant. If you need event information, then useBusReducer is probably a better choice in most cases.

codecov[bot] commented 5 years ago

Codecov Report

Merging #36 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #36   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           6      6           
  Lines          74     78    +4     
  Branches       11     11           
=====================================
+ Hits           74     78    +4
Impacted Files Coverage Δ
src/useBusState.ts 100% <100%> (ø) :arrow_up:

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 54daa57...e3f89ec. Read the comment docs.

ryardley commented 5 years ago

Also you should be able to do PRs directly from a clone of ts-bus you have access.