Add download notification, progress indicator.

This commit is contained in:
Michael Jumper committed 2013-07-01 15:01:12 -07:00
1 parent 15c9ba6ab2
commit ebcf761e53
3 files changed
+103 -7

No files matched your search

+11 -7
View File
@@ -775,16 +775,20 @@ GuacUI.Client.attach = function(guac) {
guac.onblob = function(blob) {
var download = new GuacUI.Download(blob.name);
download.updateProgress("0");
document.body.appendChild(download.getElement());
// Update progress as data is received
blob.ondata = function() {
download.updateProgress(blob.getLength());
};
// When complete, prompt for download
blob.oncomplete = function() {
var url = window.URL || window.webkitURL;
var a = document.createElement("a");
a.href = url.createObjectURL(blob.getBlob());
a.download = blob.name;
a.type = blob.mimetype;
a.click();
download.complete(blob.mimetype, url.createObjectURL(blob.getBlob()));
};
};