cordova-promise-fs
Advanced tools
Comparing version 0.7.0 to 0.8.0
{ | ||
"name": "cordova-promise-fs", | ||
"main": "dist/CordovaPromiseFS.js", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"homepage": "https://github.com/markmarijnissen/cordova-promise-fs", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -106,3 +106,3 @@ var CordovaPromiseFS = | ||
/* FileTransfer implementation for Chrome */ | ||
deviceready = Promise.resolve(); | ||
deviceready = ResolvedPromise(true); | ||
if(typeof webkitRequestFileSystem !== 'undefined'){ | ||
@@ -126,2 +126,3 @@ window.requestFileSystem = webkitRequestFileSystem; | ||
}; | ||
window.ProgressEvent = function ProgressEvent(){}; | ||
} else { | ||
@@ -134,2 +135,9 @@ window.requestFileSystem = function(x,y,z,fail){ | ||
/* Promise resolve helper */ | ||
function ResolvedPromise(value){ | ||
return new Promise(function(resolve){ | ||
return resolve(value); | ||
}); | ||
} | ||
/* the filesystem! */ | ||
@@ -326,5 +334,7 @@ var fs = new Promise(function(resolve,reject){ | ||
} else { | ||
resolve(); | ||
resolve(1); | ||
} | ||
},reject); | ||
}).then(function(val){ | ||
return val === 1? false: true; | ||
}); | ||
@@ -358,3 +368,3 @@ } | ||
dirReader.readEntries(function(entries) { | ||
var promises = [Promise.resolve(entries)]; | ||
var promises = [ResolvedPromise(entries)]; | ||
if(recursive) { | ||
@@ -422,3 +432,3 @@ entries | ||
transferOptions = {}; | ||
} | ||
} | ||
serverUrl = encodeURI(serverUrl); | ||
@@ -434,2 +444,3 @@ if(isCordova) localPath = toInternalURLSync(localPath); | ||
var ft = new FileTransfer(); | ||
onprogress = onprogress || transferOptions.onprogress; | ||
if(typeof onprogress === 'function') ft.onprogress = onprogress; | ||
@@ -436,0 +447,0 @@ var promise = new Promise(function(resolve,reject){ |
19
index.js
@@ -59,3 +59,3 @@ /** | ||
/* FileTransfer implementation for Chrome */ | ||
deviceready = Promise.resolve(); | ||
deviceready = ResolvedPromise(true); | ||
if(typeof webkitRequestFileSystem !== 'undefined'){ | ||
@@ -79,2 +79,3 @@ window.requestFileSystem = webkitRequestFileSystem; | ||
}; | ||
window.ProgressEvent = function ProgressEvent(){}; | ||
} else { | ||
@@ -87,2 +88,9 @@ window.requestFileSystem = function(x,y,z,fail){ | ||
/* Promise resolve helper */ | ||
function ResolvedPromise(value){ | ||
return new Promise(function(resolve){ | ||
return resolve(value); | ||
}); | ||
} | ||
/* the filesystem! */ | ||
@@ -279,5 +287,7 @@ var fs = new Promise(function(resolve,reject){ | ||
} else { | ||
resolve(); | ||
resolve(1); | ||
} | ||
},reject); | ||
}).then(function(val){ | ||
return val === 1? false: true; | ||
}); | ||
@@ -311,3 +321,3 @@ } | ||
dirReader.readEntries(function(entries) { | ||
var promises = [Promise.resolve(entries)]; | ||
var promises = [ResolvedPromise(entries)]; | ||
if(recursive) { | ||
@@ -375,3 +385,3 @@ entries | ||
transferOptions = {}; | ||
} | ||
} | ||
serverUrl = encodeURI(serverUrl); | ||
@@ -387,2 +397,3 @@ if(isCordova) localPath = toInternalURLSync(localPath); | ||
var ft = new FileTransfer(); | ||
onprogress = onprogress || transferOptions.onprogress; | ||
if(typeof onprogress === 'function') ft.onprogress = onprogress; | ||
@@ -389,0 +400,0 @@ var promise = new Promise(function(resolve,reject){ |
{ | ||
"name": "cordova-promise-fs", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "Cordova FileSystem convienence functions that return promises.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,4 +12,7 @@ cordova-promise-fs | ||
bower install cordova-promise-fs | ||
bower install bluebird # a library that follows the Promise/A+ spec | ||
# ...or npm... | ||
npm install cordova-promise-fs | ||
npm install bluebird # a library that follows the Promise/A+ spec | ||
@@ -38,2 +41,4 @@ # install Cordova and plugins | ||
The Promise option expects a Promise library that follows the [Promise/A+ spec](https://promisesaplus.com/), such as bluebird ([github](https://github.com/petkaantonov/bluebird), [download](https://raw.githubusercontent.com/markmarijnissen/cordova-app-loader/master/www/lib/bluebird.js)), promiscuous ([github](https://github.com/RubenVerborgh/promiscuous),[file](https://raw.githubusercontent.com/RubenVerborgh/promiscuous/master/promiscuous.js)) or [Angular's $q](https://docs.angularjs.org/api/ng/service/$q). | ||
**Note on concurrency:** Concurrent uploads/downloads completely trash your mobile application. That's why I've put a concurrency limit on the number of downloads/uploads. Meteor sets this number on 30. In my experimental testing, I found 3 much more reasonable. | ||
@@ -114,2 +119,6 @@ | ||
### 0.8.0 (27/11/2014) | ||
* Added test-suite, fixed few minor bugs. | ||
### 0.7.0 (14/11/2014) | ||
@@ -149,2 +158,9 @@ | ||
Run tests: Navigate to `/test/index.html`, for example: | ||
```bash | ||
npm install static -g | ||
static . | ||
# http://localhost:8080/test/index.html | ||
``` | ||
Feel free to contribute to this project in any way. The easiest way to support this project is by giving it a star. | ||
@@ -151,0 +167,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
118438
11
3605
169
1