summaryrefslogtreecommitdiff
path: root/frontend/src/sagas/utils.js
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@amadeus.com>2017-07-24 19:40:23 +0200
committerJoffrey Bion <joffrey.bion@amadeus.com>2017-07-24 19:40:23 +0200
commit43685fd7ff83ed03342c273851e69228adde8dc7 (patch)
tree46062865800317bcaf62eb0bfd6d681dc17ddd41 /frontend/src/sagas/utils.js
parentIsolate Seven Wonders API from sagas (diff)
downloadseven-wonders-43685fd7ff83ed03342c273851e69228adde8dc7.tar.gz
seven-wonders-43685fd7ff83ed03342c273851e69228adde8dc7.tar.bz2
seven-wonders-43685fd7ff83ed03342c273851e69228adde8dc7.zip
Decouple Seven Wonders API from saga channels API
Diffstat (limited to 'frontend/src/sagas/utils.js')
-rw-r--r--frontend/src/sagas/utils.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/frontend/src/sagas/utils.js b/frontend/src/sagas/utils.js
new file mode 100644
index 00000000..28017c87
--- /dev/null
+++ b/frontend/src/sagas/utils.js
@@ -0,0 +1,10 @@
+import { SevenWondersSession } from '../api/sevenWondersApi';
+import { eventChannel } from 'redux-saga';
+
+type Emitter = (value: any) => void;
+
+export function createChannel(session: SevenWondersSession, methodWithCallback: () => void, ...args: Array<any>) {
+ return eventChannel((emitter: Emitter) => {
+ return methodWithCallback.call(session, ...args, emitter);
+ });
+}
bgstack15