fix backup file download
This commit is contained in:
parent
839344a0b5
commit
0c786ebd6a
2 changed files with 6 additions and 26 deletions
|
|
@ -694,19 +694,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
|
||||
self.csvHistory = function() {
|
||||
|
||||
function saveFile(name, data) {
|
||||
var chooser = document.querySelector(name);
|
||||
chooser.addEventListener("change", function(evt) {
|
||||
var fs = require('fs');
|
||||
fs.writeFile(this.value, data, function(err) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
}
|
||||
});
|
||||
}, false);
|
||||
chooser.click();
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
var dateObj = new Date(date);
|
||||
if (!dateObj) {
|
||||
|
|
|
|||
|
|
@ -31,25 +31,18 @@ angular.module('copayApp.services')
|
|||
});
|
||||
$log.debug("case 3");
|
||||
} else {
|
||||
// We're screwed, blob constructor unsupported entirely
|
||||
// We're screwed, blob constructor unsupported entirely
|
||||
$log.debug("Error");
|
||||
}
|
||||
}
|
||||
return out;
|
||||
};
|
||||
|
||||
var a = document.createElement("a");
|
||||
document.body.appendChild(a);
|
||||
a.style.display = "none";
|
||||
|
||||
var a = angular.element('<a></a>');
|
||||
var blob = new NewBlob(ew, 'text/plain;charset=utf-8');
|
||||
var url = window.URL.createObjectURL(blob);
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
a.click();
|
||||
$timeout(function() {
|
||||
window.URL.revokeObjectURL(url);
|
||||
}, 250);
|
||||
a.attr('href',window.URL.createObjectURL(blob));
|
||||
a.attr('download', filename);
|
||||
a[0].click();
|
||||
return cb();
|
||||
};
|
||||
|
||||
|
|
@ -92,4 +85,4 @@ angular.module('copayApp.services')
|
|||
_download(ew, filename, cb)
|
||||
};
|
||||
return root;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue