Skip to content

Instantly share code, notes, and snippets.

@puemos
Last active May 6, 2018 07:35
Show Gist options
  • Save puemos/c8b26b18a13e27360dc9eef0899117cd to your computer and use it in GitHub Desktop.
Save puemos/c8b26b18a13e27360dc9eef0899117cd to your computer and use it in GitHub Desktop.
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