fix backup file download

This commit is contained in:
Gabriel Bazán 2016-05-20 11:10:53 -03:00 committed by Javier
commit 0c786ebd6a
2 changed files with 6 additions and 26 deletions

View file

@ -694,19 +694,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.csvHistory = function() { 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) { function formatDate(date) {
var dateObj = new Date(date); var dateObj = new Date(date);
if (!dateObj) { if (!dateObj) {

View file

@ -38,18 +38,11 @@ angular.module('copayApp.services')
return out; return out;
}; };
var a = document.createElement("a"); var a = angular.element('<a></a>');
document.body.appendChild(a);
a.style.display = "none";
var blob = new NewBlob(ew, 'text/plain;charset=utf-8'); var blob = new NewBlob(ew, 'text/plain;charset=utf-8');
var url = window.URL.createObjectURL(blob); a.attr('href',window.URL.createObjectURL(blob));
a.href = url; a.attr('download', filename);
a.download = filename; a[0].click();
a.click();
$timeout(function() {
window.URL.revokeObjectURL(url);
}, 250);
return cb(); return cb();
}; };