mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Capture events on tmp download link created by FileUtils
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
(function () {
|
||||
var ns = $.namespace('pskl.utils');
|
||||
|
||||
var stopPropagation = function (e) {
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
ns.FileUtils = {
|
||||
readFile : function (file, callback) {
|
||||
var reader = new FileReader();
|
||||
@@ -20,7 +24,9 @@
|
||||
downloadLink.setAttribute('href', content);
|
||||
downloadLink.setAttribute('download', filename);
|
||||
document.body.appendChild(downloadLink);
|
||||
downloadLink.addEventListener('click', stopPropagation);
|
||||
downloadLink.click();
|
||||
downloadLink.removeEventListener('click', stopPropagation);
|
||||
document.body.removeChild(downloadLink);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user