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

cordova-app-loader

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-app-loader - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

bin/update-manifest.js

2

bootstrap.js

@@ -75,3 +75,3 @@ (function(){

el.type = "text/css";
loadScript();
setTimeout(loadScript,0);
}

@@ -78,0 +78,0 @@ head.appendChild(el);

{
"name": "cordova-app-loadaer",
"main": "www/lib/CordovaAppLoader.js",
"version": "0.1.1",
"version": "0.2.0",
"homepage": "https://github.com/markmarijnissen/cordova-file-cache",

@@ -6,0 +6,0 @@ "authors": [

@@ -55,8 +55,8 @@ var CordovaFileCache = require('cordova-file-cache');

self._toBeDeleted = Object.keys(manifest.files)
.concat(self._toBeDownloaded)
.filter(function(file){
return !newManifest.files[file] && self.cache.isCached(file);
})
.concat(self._toBeDownloaded);
if(self._toBeDeleted.length > 0){
});
if(self._toBeDeleted.length > 0 || self._toBeDownloaded.length > 0){
// Save the new Manifest

@@ -101,4 +101,8 @@ self.newManifest = newManifest;

self._toBeDeleted = [];
self._toBeDownloaded = [];
self._updateReady = true;
return self.newManifest;
},function(files){
self.cache.remove(files);
return files;
});

@@ -125,2 +129,4 @@ };

location.reload();
},function(){
location.reload();
});

@@ -127,0 +133,0 @@ };

{
"name": "cordova-app-loader",
"version": "0.1.1",
"version": "0.2.0",
"description": "Cordova App Loader - remote update your cordova app",

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

"dependencies": {
"cordova-file-cache": "^0.2.1"
"cordova-file-cache": "^0.2.2"
}
}

@@ -5,2 +5,4 @@ cordova-app-loader

Based on [cordova-promise-fs](https://github.com/markmarijnissen/cordova-promise-fs) and [cordova-file-cache](https://github.com/markmarijnissen/cordova-file-cache).
## Getting started

@@ -22,3 +24,3 @@

Or just download and include [CordovaPromiseFS.js](https://raw.githubusercontent.com/markmarijnissen/cordova-promise-fs/master/dist/CordovaPromiseFS.js) and [CordovaFileCache.js](https://raw.githubusercontent.com/markmarijnissen/cordova-file-cache/master/dist/CordovaFileCache.js)
Or just download and include [CordovaPromiseFS.js](https://raw.githubusercontent.com/markmarijnissen/cordova-promise-fs/master/dist/CordovaPromiseFS.js) and [CordovaAppLoader.js](https://raw.githubusercontent.com/markmarijnissen/cordova-app-loader/master/www/lib/CordovaAppLoader.js)

@@ -66,2 +68,7 @@ ## Demo

You can automatically create a version based on the checksum of the file:
```bash
bin/update-manifest www www/manifest.json
```
### Step 2: Add [bootstrap.js](https://raw.githubusercontent.com/markmarijnissen/cordova-app-loader/master/www/bootstrap.js) to your [index.html](https://raw.githubusercontent.com/markmarijnissen/cordova-app-loader/master/www/index.html)

@@ -109,2 +116,8 @@

### 0.2.0 (09/11/2014)
* Improved app layout
* Added test-cases to the app (slow, broken app, broken download)
* Several bugfixes
### 0.1.0 (07/11/2014)

@@ -111,0 +124,0 @@

@@ -75,3 +75,3 @@ (function(){

el.type = "text/css";
loadScript();
setTimeout(loadScript,0);
}

@@ -78,0 +78,0 @@ head.appendChild(el);

@@ -102,8 +102,8 @@ var CordovaAppLoader =

self._toBeDeleted = Object.keys(manifest.files)
.concat(self._toBeDownloaded)
.filter(function(file){
return !newManifest.files[file] && self.cache.isCached(file);
})
.concat(self._toBeDownloaded);
if(self._toBeDeleted.length > 0){
});
if(self._toBeDeleted.length > 0 || self._toBeDownloaded.length > 0){
// Save the new Manifest

@@ -148,4 +148,8 @@ self.newManifest = newManifest;

self._toBeDeleted = [];
self._toBeDownloaded = [];
self._updateReady = true;
return self.newManifest;
},function(files){
self.cache.remove(files);
return files;
});

@@ -172,2 +176,4 @@ };

location.reload();
},function(){
location.reload();
});

@@ -306,35 +312,44 @@ };

// augment progress event with index/total stats
var onSingleDownloadProgress;
if(typeof onprogress === 'function') {
onSingleDownloadProgress = function(ev){
ev.index = index;
ev.total = total;
onprogress(ev);
};
}
// callback
var onDone = function(){
index++;
// when we're done
if(index !== total) {
// reset downloads
self._downloading = [];
// check if we got everything
self.list().then(function(){
// Yes, we're not dirty anymore!
if(!self.isDirty()) {
resolve(self);
// Aye, some files got left behind!
} else {
reject(self.getDownloadQueue());
// download every file in the queue (which is the diff from _added with _cached)
queue.forEach(function(url){
var path = self.toPath(url);
// augment progress event with index/total stats
var onSingleDownloadProgress;
if(typeof onprogress === 'function') {
onSingleDownloadProgress = function(ev){
ev.queueIndex = index;
ev.queueSize = total;
ev.url = url;
ev.path = path;
ev.percentage = index / total;
if(ev.loaded > 0 && ev.total > 0 && index !== total){
ev.percentage += (ev.loaded / ev.total) / total;
}
},reject);
onprogress(ev);
};
}
};
// download every file in the queue (which is the diff from _added with _cached)
queue.forEach(function(url,index){
var download = fs.download(url,self.toPath(url),{retry:self._retry},onSingleDownloadProgress);
// callback
var onDone = function(){
index++;
// when we're done
if(index === total) {
// reset downloads
self._downloading = [];
// check if we got everything
self.list().then(function(){
// final progress event!
if(onSingleDownloadProgress) onSingleDownloadProgress(new ProgressEvent());
// Yes, we're not dirty anymore!
if(!self.isDirty()) {
resolve(self);
// Aye, some files got left behind!
} else {
reject(self.getDownloadQueue());
}
},reject);
}
};
var download = fs.download(url,path,{retry:self._retry},onSingleDownloadProgress);
download.then(onDone,onDone);

@@ -341,0 +356,0 @@ self._downloading.push(download);

@@ -348,2 +348,3 @@ var CordovaPromiseFS =

ft.download.apply(ft,args);
if(ft.onprogress) ft.onprogress(new ProgressEvent());
} else {

@@ -378,6 +379,8 @@ // Stupid API. 'upload' switched around the 'trustAllHosts' and 'options' arguments.

if(!transferOptions.retry || !transferOptions.retry.length) {
transferOptions.retry = options.retry.concat();
transferOptions.retry = options.retry;
}
transferOptions.retry = transferOptions.retry.concat();
var ft = new FileTransfer();
if(typeof onprogress === 'function') ft.onprogress = onprogress;
var promise = new Promise(function(resolve,reject){

@@ -402,3 +405,2 @@ var attempt = function(err){

promise.then(nextTransfer,nextTransfer);
if(typeof onprogress === 'function') ft.onprogress = onprogress;
promise.progress = function(onprogress){

@@ -405,0 +407,0 @@ ft.onprogress = onprogress;

Sorry, the diff of this file is not supported yet

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