Skip to content

Commit

Permalink
apps/gallery/js/gallery.js
Browse files Browse the repository at this point in the history
  • Loading branch information
David Flanagan committed Sep 28, 2012
1 parent 9ce07a2 commit 0a25aa9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions shared/js/mediadb.js
Expand Up @@ -297,6 +297,8 @@
* DeviceStorage events. This permanently puts the MediaDB object into
* the MediaDB.CLOSED state in which it is unusable.
*
* - stat(): call the DeviceStorage stat() method and pass an the stats
* object to the specified callback
*/
var MediaDB = (function() {

Expand Down Expand Up @@ -762,6 +764,19 @@ var MediaDB = (function() {
cancelEnumeration: function(handle) {
if (handle.state === 'enumerating')
handle.state = 'cancelling';
},

// Use the device storage stat() method and pass the resulting
// stats object to the callback. The stats object has properties
// totalBytes, freeBytes and state.
stat: function stat(callback) {
if (this.state !== MediaDB.READY)
throw Error('MediaDB is not ready. State: ' + this.state);

var statreq = this.storage.stat();
statreq.onsuccess = function() {
callback(statreq.result);
}
}
};

Expand Down

0 comments on commit 0a25aa9

Please sign in to comment.