gecko-dev/dom/file/tests/create_file_objects.js

16 строки
395 B
JavaScript

Cu.importGlobalProperties(['File']);
addMessageListener("create-file-objects", function(message) {
let files = []
let promises = [];
for (fileName of message.fileNames) {
promises.push(File.createFromFileName(fileName).then(function(file) {
files.push(file);
}));
}
Promise.all(promises).then(function() {
sendAsyncMessage("created-file-objects", files);
});
});