Ensure that savers invoke the callback

print-window-tiddler
Jermolene 2014-08-27 09:59:01 +01:00
rodzic e47852cb14
commit ab41462af3
5 zmienionych plików z 13 dodań i 4 usunięć

Wyświetl plik

@ -38,6 +38,8 @@ DownloadSaver.prototype.save = function(text,method,callback) {
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
// Callback that we succeeded
callback(null);
return true;
};

Wyświetl plik

@ -33,14 +33,16 @@ FSOSaver.prototype.save = function(text,method,callback) {
pathname = pathname.substr(1);
// reconstruct UNC path
pathname = "\\\\" + document.location.hostname + pathname;
} else return false;
} else {
return false;
}
// Save the file (as UTF-16)
var fso = new ActiveXObject("Scripting.FileSystemObject");
var file = fso.OpenTextFile(pathname,2,-1,-1);
file.Write(text);
file.Close();
// Callback that we succeeded
callback(null);
return true;
};

Wyświetl plik

@ -25,6 +25,8 @@ ManualDownloadSaver.prototype.save = function(text,method,callback) {
$tw.modal.display(downloadInstructionsTitle,{
downloadLink: "data:text/html," + encodeURIComponent(text)
});
// Callback that we succeeded
callback(null);
return true;
};

Wyświetl plik

@ -28,6 +28,8 @@ MsDownloadSaver.prototype.save = function(text,method,callback) {
// Set up the link
var blob = new Blob([text], {type: "text/html"});
window.navigator.msSaveBlob(blob,filename);
// Callback that we succeeded
callback(null);
return true;
};

Wyświetl plik

@ -35,9 +35,10 @@ TiddlyIESaver.prototype.save = function(text,method,callback) {
// reconstruct UNC path
pathname = "\\\\" + document.location.hostname + pathname;
} else return false;
// Prompt the user to save the file
window.TiddlyIE.save(pathname, text);
// Callback that we succeeded
callback(null);
return true;
} else {
return false;