Skip to content

Commit

Permalink
initial poc
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkis committed Feb 13, 2016
0 parents commit 17c9b3e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "redux-saga-rxjs",
"version": "0.1.0",
"description": "Saga pattern for Redux implemented using rxjs",
"main": "index.js",
"author": "Tomas Weiss <tomas.weiss2@gmail.com>",
"license": "MIT",
"peerDependencies": {
"rxjs": "^5.0.0-beta.2"
}
}
15 changes: 15 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Subject } from 'rxjs';

const sagaMiddleware = (...sagas) => {
const subject = new Subject();

return store => {
sagas.forEach(saga =>
saga(subject).subscribe(dispatchable => store.dispatch(dispatchable));

return next => action => {
next(action);
subject.next(action, store.getState());
};
};
};

0 comments on commit 17c9b3e

Please sign in to comment.