Last active
October 7, 2021 04:12
-
-
Save rexxars/9111474 to your computer and use it in GitHub Desktop.
Async.js + imboclient.js
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
var imbo = new Imbo.Client('host', 'pub', 'priv'); | |
var fileInput = document.querySelector('input[type=file]'); | |
fileInput.addEventListener('change', uploadFiles, false); | |
function uploadFiles() { | |
async.mapSeries( | |
fileInput.files, | |
imbo.addImage.bind(imbo), | |
onFilesUploaded | |
); | |
}; | |
function onFilesUploaded(err, imageIdentifiers) { | |
if (err) { | |
return console.error('Failed to upload images!', err); | |
} | |
console.log(imageIdentifiers.map(imbo.getImageUrl.bind(imbo))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment