Migrate blob to input stream (ish) API.

This commit is contained in:
Michael Jumper
2013-09-24 13:14:26 -07:00
parent 8848b87c21
commit 68e2e2b028
2 changed files with 68 additions and 64 deletions

View File

@@ -790,23 +790,23 @@ GuacUI.Client.attach = function(guac) {
}
guac.onblob = function(blob) {
guac.onfile = function(filename, stream) {
var download = new GuacUI.Download(blob.name);
var download = new GuacUI.Download(filename);
download.updateProgress(getSizeString(0));
GuacUI.Client.notification_area.appendChild(download.getElement());
// Update progress as data is received
blob.ondata = function() {
download.updateProgress(getSizeString(blob.getLength()));
stream.onreceive = function() {
download.updateProgress(getSizeString(stream.getLength()));
};
// When complete, prompt for download
blob.oncomplete = function() {
stream.onclose = function() {
download.ondownload = function() {
saveAs(blob.getBlob(), blob.name);
saveAs(stream.getBlob(), filename);
};
download.complete();