lookupAsync
by Artem
JavaScript
'use strict';
function downloadAsync(url, callback) {
setTimeout(() => {
callback('file1');
}, 1000);
}
function lookupAsync(type, callback) {
setTimeout(() => {
callback('https://google.com');
}, 1000);
}
function showContents(url, text) {
console.log(url, text);
}
function downloadURL(url) {
downloadAsync(url, showContents.bind(null, url));
}
lookupAsync('url', downloadURL);