I implement copy-paste functions in a browser application using the ClipboardData API, as explained in this answer.
FileReader::readAsDataURL(blob) provides asynchronous reading of file data, which is excellent.
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
var reader = new FileReader();
reader.onload = function(event){
};
var blob = items[0].getAsFile();
reader.readAsDataURL(blob);
Questions:
1) Is there a way to make the method DataTransferItem::getAsFile()asynchronous?
2) Is there a way to get FileReaderto take DataTransferItemas an argument so that it can do it itself asyncjust like using blobs?
3) Am I lucky?
source
share