From 43685fd7ff83ed03342c273851e69228adde8dc7 Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Mon, 24 Jul 2017 19:40:23 +0200 Subject: Decouple Seven Wonders API from saga channels API --- frontend/src/sagas/utils.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 frontend/src/sagas/utils.js (limited to 'frontend/src/sagas/utils.js') 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) { + return eventChannel((emitter: Emitter) => { + return methodWithCallback.call(session, ...args, emitter); + }); +} -- cgit