Skip to content

Instantly share code, notes, and snippets.

@puemos
Last active May 6, 2018 07:27
Show Gist options
  • Save puemos/88804847c32e24d9eed0e1efd8c398d2 to your computer and use it in GitHub Desktop.
Save puemos/88804847c32e24d9eed0e1efd8c398d2 to your computer and use it in GitHub Desktop.
// the first to fire between "all done" and "cancel"
const { cancelDownload, allDone } = yield race({
allDone: take(allDoneChannel),
cancelDownload: take("CANCEL_DOWNLOAD")
});
// stop the queue manager
yield cancel(watcherTask);
// in case of cancellation just return;
if (cancelDownload){
return;
}
// in case of "all done" create a link and put a new action
if (allDone) {
const link = URL.createObjectURL(blobBuilder.build());
yield put(downloadFinished({ id, link }));
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment