Last active
April 17, 2019 22:25
-
-
Save keehun/df56304f2c2dca2cac37e86619405e55 to your computer and use it in GitHub Desktop.
This file contains 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
async function getMoviePackageFor(movie_id) { | |
/// Get the URLs of the movie and subtitle file in parallel | |
const movie_url = await MovieDatabase.getURLFor(movie_id) | |
const subtitle_url = await SubtitleDatabase.getURLFor(movie_id) | |
/* | |
By the way, if you want those two async actions to run in | |
parallel, you can do this: | |
const [movie_url, subtitle_url] = await Promise.all([ | |
MovieDatabase.getURLFor(movie_id), | |
SubtitleDatabase.getURLFor(movie_id), | |
]) | |
*/ | |
const movie_file = await DownloadTool.download(movie_url) | |
const subtitle_file = await DownloadTool.download(subtitle_url) | |
return [movie_file, subtitle_file] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment