Last active
May 6, 2018 07:35
-
-
Save puemos/c8b26b18a13e27360dc9eef0899117cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function* handler({ uri, index, segmentsCount }) { | |
// get the data | |
const res = yield call(fetch, uri); | |
const blob = yield res.blob(); | |
// report to the store | |
yield put({ type: "CHUNK_DONE", payload: { index, blob } }) | |
// check if all the chunk are ready | |
const currentChunkCount = yield select(currentChunkCountSelector) | |
if (currentChunkCout === segmentsCount) { | |
yield allDoneChannel.put({ type: "DONE" }); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment