Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cordova-file-cache

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-file-cache - npm Package Compare versions

Comparing version 0.12.0 to 0.13.0

15

dist/CordovaFileCache.js

@@ -177,4 +177,2 @@ var CordovaFileCache =

var queue = self.getDownloadQueue();
var started = [];
var index = self._downloading.length;
var done = self._downloading.length;

@@ -186,18 +184,14 @@ var total = self._downloading.length + queue.length;

var path = self.toPath(url);
// augment progress event with index/total stats
// augment progress event with done/total stats
var onSingleDownloadProgress;
if(typeof onprogress === 'function') {
onSingleDownloadProgress = function(ev){
ev.queueIndex = index;
ev.queueIndex = done;
ev.queueSize = total;
ev.url = url;
ev.path = path;
ev.percentage = index / total;
ev.percentage = done / total;
if(ev.loaded > 0 && ev.total > 0 && index !== total){
ev.percentage += (ev.loaded / ev.total) / total;
}
if(started.indexOf(url) < 0) {
started.push(url);
index++;
}
onprogress(ev);

@@ -210,2 +204,3 @@ };

done++;
// when we're done

@@ -313,3 +308,3 @@ if(done === total) {

/* 1 */
/***/ function(module, exports, __webpack_require__) {
/***/ function(module, exports) {

@@ -316,0 +311,0 @@ /**

@@ -130,4 +130,2 @@ var hash = require('./murmerhash');

var queue = self.getDownloadQueue();
var started = [];
var index = self._downloading.length;
var done = self._downloading.length;

@@ -139,18 +137,14 @@ var total = self._downloading.length + queue.length;

var path = self.toPath(url);
// augment progress event with index/total stats
// augment progress event with done/total stats
var onSingleDownloadProgress;
if(typeof onprogress === 'function') {
onSingleDownloadProgress = function(ev){
ev.queueIndex = index;
ev.queueIndex = done;
ev.queueSize = total;
ev.url = url;
ev.path = path;
ev.percentage = index / total;
ev.percentage = done / total;
if(ev.loaded > 0 && ev.total > 0 && index !== total){
ev.percentage += (ev.loaded / ev.total) / total;
}
if(started.indexOf(url) < 0) {
started.push(url);
index++;
}
onprogress(ev);

@@ -163,2 +157,3 @@ };

done++;
// when we're done

@@ -165,0 +160,0 @@ if(done === total) {

{
"name": "cordova-file-cache",
"version": "0.12.0",
"version": "0.13.0",
"description": "Cordova File Cache",

@@ -22,4 +22,4 @@ "main": "index.js",

"dependencies": {
"cordova-promise-fs": "^0.12.0"
"cordova-promise-fs": "^0.13.0"
}
}

@@ -30,3 +30,3 @@ cordova-file-cache

// Initialize a Cache
var cache = CordovaFileCache({
var cache = new CordovaFileCache({
fs: new CordovaPromiseFS({ // An instance of CordovaPromiseFS is REQUIRED

@@ -37,3 +37,3 @@ Promise: Promise // <-- your favorite Promise lib (REQUIRED)

localRoot: 'data', //optional
serverRoot: 'http://yourserver.com/files/' // optional, required on 'mirror' mode
serverRoot: 'http://yourserver.com/files/', // optional, required on 'mirror' mode
cacheBuster: false // optional

@@ -69,10 +69,15 @@ });

// Downloading files.
// The optional 'onprogress' event handler is enhanced with information
// about the total download queue.
// It is recommended to avoid heavy UI and animation while downloading.
var onprogress = function(e) {
var progress ="Progress: "
+ e.queueIndex // current download index
+ " "
+ e.queueSize; // total files to download
// Download files.
cache.download(onprogress).then(function(cache){ ... },function(failedDownloads) { ... })
// It is recommended to avoid heavy UI and animation while downloading.
// The optional 'onprogress' event handler is enhanced with information
// about the total download queue:
onprogress = function(ProgressEvent) {
ProgressEvent.index // current download index
ProgressEvent.total // total files to download
}

@@ -129,2 +134,6 @@ ```

### 0.13.0 (23/01/2016)
* Fix download onprogress index
### 0.12.0 (18/03/2014)

@@ -194,2 +203,2 @@

© 2014 - Mark Marijnissen
© 2014 - Mark Marijnissen
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc