cordova-file-cache
Advanced tools
Comparing version 0.13.0 to 0.14.0
@@ -179,2 +179,3 @@ var CordovaFileCache = | ||
var total = self._downloading.length + queue.length; | ||
var percentage = 0; | ||
@@ -193,5 +194,7 @@ // download every file in the queue (which is the diff from _added with _cached) | ||
ev.percentage = done / total; | ||
if(ev.loaded > 0 && ev.total > 0 && index !== total){ | ||
if(ev.loaded > 0 && ev.total > 0 && done !== total){ | ||
ev.percentage += (ev.loaded / ev.total) / total; | ||
} | ||
ev.percentage = Math.max(percentage,ev.percentage); | ||
percentage = ev.percentage; | ||
onprogress(ev); | ||
@@ -299,3 +302,7 @@ }; | ||
} else { | ||
return this.localRoot + hash(url) + url.substr(url.lastIndexOf('.')); | ||
var ext = url.substr(url.lastIndexOf('.')); | ||
if ((ext.indexOf("?") > 0) || (ext.indexOf("/") > 0)) { | ||
ext = ".txt"; | ||
} | ||
return this.localRoot + hash(url) + ext; | ||
} | ||
@@ -302,0 +309,0 @@ }; |
11
index.js
@@ -132,2 +132,3 @@ var hash = require('./murmerhash'); | ||
var total = self._downloading.length + queue.length; | ||
var percentage = 0; | ||
@@ -146,5 +147,7 @@ // download every file in the queue (which is the diff from _added with _cached) | ||
ev.percentage = done / total; | ||
if(ev.loaded > 0 && ev.total > 0 && index !== total){ | ||
if(ev.loaded > 0 && ev.total > 0 && done !== total){ | ||
ev.percentage += (ev.loaded / ev.total) / total; | ||
} | ||
ev.percentage = Math.max(percentage,ev.percentage); | ||
percentage = ev.percentage; | ||
onprogress(ev); | ||
@@ -252,3 +255,7 @@ }; | ||
} else { | ||
return this.localRoot + hash(url) + url.substr(url.lastIndexOf('.')); | ||
var ext = url.substr(url.lastIndexOf('.')); | ||
if ((ext.indexOf("?") > 0) || (ext.indexOf("/") > 0)) { | ||
ext = ".txt"; | ||
} | ||
return this.localRoot + hash(url) + ext; | ||
} | ||
@@ -255,0 +262,0 @@ }; |
{ | ||
"name": "cordova-file-cache", | ||
"version": "0.13.0", | ||
"version": "0.14.0", | ||
"description": "Cordova File Cache", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -131,2 +131,7 @@ cordova-file-cache | ||
### 0.14.0 (07/02/2016) | ||
* Handle REST api calls better (thanks @xontab) | ||
* Fix download onprogress index | ||
### 0.13.0 (23/01/2016) | ||
@@ -136,7 +141,7 @@ | ||
### 0.12.0 (18/03/2014) | ||
### 0.12.0 (18/03/2015) | ||
* Export hash function as CordovaFileCache.hash (needed by App Loader) | ||
### 0.11.0 (17/03/2014) | ||
### 0.11.0 (17/03/2015) | ||
@@ -143,0 +148,0 @@ * Update CordovaPromiseFS dependency. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109321
3271
205