Path: blob/trunk/third_party/closure/goog/fs/progressevent.js
2868 views
// Copyright 2011 The Closure Library Authors. All Rights Reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS-IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314/**15* @fileoverview A wrapper for the HTML5 File ProgressEvent objects.16*17*/18goog.provide('goog.fs.ProgressEvent');1920goog.require('goog.events.Event');21222324/**25* A wrapper for the progress events emitted by the File APIs.26*27* @param {!ProgressEvent} event The underlying event object.28* @param {!Object} target The file access object emitting the event.29* @extends {goog.events.Event}30* @constructor31* @final32*/33goog.fs.ProgressEvent = function(event, target) {34goog.fs.ProgressEvent.base(this, 'constructor', event.type, target);3536/**37* The underlying event object.38* @type {!ProgressEvent}39* @private40*/41this.event_ = event;42};43goog.inherits(goog.fs.ProgressEvent, goog.events.Event);444546/**47* @return {boolean} Whether or not the total size of the of the file being48* saved is known.49*/50goog.fs.ProgressEvent.prototype.isLengthComputable = function() {51return this.event_.lengthComputable;52};535455/**56* @return {number} The number of bytes saved so far.57*/58goog.fs.ProgressEvent.prototype.getLoaded = function() {59return this.event_.loaded;60};616263/**64* @return {number} The total number of bytes in the file being saved.65*/66goog.fs.ProgressEvent.prototype.getTotal = function() {67return this.event_.total;68};697071