Debian Codegraph @

closure-library/closure/goog/fs/progressevent.js

raw
1 // Copyright 2011 The Closure Library Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS-IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 /**
16 * @fileoverview A wrapper for the HTML5 File ProgressEvent objects.
17 *
18 */
19 goog.provide('goog.fs.ProgressEvent');
20
21 goog.require('goog.events.Event');
22
23
24
25 /**
26 * A wrapper for the progress events emitted by the File APIs.
27 *
28 * @param {!ProgressEvent} event The underlying event object.
29 * @param {!Object} target The file access object emitting the event.
30 * @extends {goog.events.Event}
31 * @constructor
32 * @final
33 */
34 goog.fs.ProgressEvent = function(event, target) {
35 goog.fs.ProgressEvent.base(this, 'constructor', event.type, target);
36
37 /**
38 * The underlying event object.
39 * @type {!ProgressEvent}
40 * @private
41 */
42 this.event_ = event;
43 };
44 goog.inherits(goog.fs.ProgressEvent, goog.events.Event);
45
46
47 /**
48 * @return {boolean} Whether or not the total size of the of the file being
49 * saved is known.
50 */
51 goog.fs.ProgressEvent.prototype.isLengthComputable = function() {
52 return this.event_.lengthComputable;
53 };
54
55
56 /**
57 * @return {number} The number of bytes saved so far.
58 */
59 goog.fs.ProgressEvent.prototype.getLoaded = function() {
60 return this.event_.loaded;
61 };
62
63
64 /**
65 * @return {number} The total number of bytes in the file being saved.
66 */
67 goog.fs.ProgressEvent.prototype.getTotal = function() {
68 return this.event_.total;
69 };