Refactor downloadAsFile to accept blob

This commit is contained in:
Dávid Szabó 2016-09-23 13:49:49 +02:00 committed by Julian Descottes
parent 38cbfe4fce
commit 6c50816830
2 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@
var fileName = piskelName + '-' + timestamp + '.piskel';
try {
pskl.utils.FileUtils.downloadAsFile(serialized, fileName);
pskl.utils.FileUtils.downloadAsFile(new Blob([serialized]), fileName);
deferred.resolve();
} catch (e) {
deferred.reject(e.message);

View File

@ -36,7 +36,7 @@
saveAs(content, filename);
} else {
var downloadLink = document.createElement('a');
content = window.URL.createObjectURL(new Blob([content]));
content = window.URL.createObjectURL(content);
downloadLink.setAttribute('href', content);
downloadLink.setAttribute('download', filename);
document.body.appendChild(downloadLink);