Add docs to new GuacUI.Download object.

This commit is contained in:
Michael Jumper
2013-06-25 11:56:25 -07:00
parent ebcf761e53
commit c1f1e0adfc

View File

@@ -691,6 +691,13 @@ GuacUI.Pager = function(container) {
}; };
/**
* Interface object which displays the progress of a download, ultimately
* becoming a download link once complete.
*
* @constructor
* @param {String} filename The name the file will have once complete.
*/
GuacUI.Download = function(filename) { GuacUI.Download = function(filename) {
var element = GuacUI.createElement("div", "download notification"); var element = GuacUI.createElement("div", "download notification");
@@ -699,10 +706,22 @@ GuacUI.Download = function(filename) {
var progress = GuacUI.createChildElement(element, "div", "progress"); var progress = GuacUI.createChildElement(element, "div", "progress");
/**
* Updates the content of the progress indicator with the given text.
*
* @param {String} text The text to assign to the progress indicator.
*/
this.updateProgress = function(text) { this.updateProgress = function(text) {
progress.textContent = text; progress.textContent = text;
}; };
/**
* Given the mimetype and URL for the final download, removes the progress
* indicator and replaces it with a download link for the completed file.
*
* @param {String} mimetype The mimetype of the download.
* @param {String} url The URL of the download.
*/
this.complete = function(mimetype, url) { this.complete = function(mimetype, url) {
element.removeChild(progress); element.removeChild(progress);