diff options
Diffstat (limited to 'frontend/src/sagas/utils.js')
-rw-r--r-- | frontend/src/sagas/utils.js | 10 |
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); + }); +} |