Skip to content

Commit

Permalink
feat: 🎸 add epic plugin implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Jun 16, 2018
1 parent d85cd95 commit 60c7a78
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/plugins/epic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const plugin = (epic) => store => {
const observable = (observer) => {
const dispatch = store.dispatch
let live = true

store.dispatch = (action) => {
dispatch(action)

if (live) {
observer.next(action)
}
}

const unsubscribe = () => {
live = false
}

return unsubscribe
}

epic(observable)(store.dispatch)
}

export default plugin

1 comment on commit 60c7a78

@streamich
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build version: 1.4.0-feat-epic.205 🤞 feat-epic on Travis 🎉

Please sign in to comment.