
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
cordova-app-loader
Advanced tools
Remote update your Cordova App
# fetch code using bower
bower install cordova-app-loader cordova-promise-fs
# ...or npm...
npm install cordova-app-loader cordova-promise-fs
# install Cordova and plugins
cordova platform add ios@3.7.0
cordova plugin add org.apache.cordova.file
cordova plugin add org.apache.cordova.file-transfer
IMPORTANT: For iOS, use Cordova 3.7.0 or higher (due to a bug that affects requestFileSystem).
Or just download and include CordovaPromiseFS.js and CordovaFileCache.js
git clone git@github.com:markmarijnissen/cordova-app-loader.git
cd cordova-app-loader
cordova platform add ios@3.7.0
cordova plugin add org.apache.cordova.file
cordova plugin add org.apache.cordova.file-transfer
cordova serve
# in a new terminal tab:
cordova run ios
If you want to run on a real device, modify serverRoot
in www/test/test.js
to point to your local server!
manifest.json
{
"files":{ // Files to download. Only newer versions will be downloaded!
"lib/jquery.min.js": { "version": 0 },
"lib/bluebird.js": { "version": 0 },
"lib/CordovaPromiseFS.js": { "version": 0 },
"lib/CordovaAppLoader.js": { "version": 0 },
"test/template.html": {"version": 0},
"test/test.js": { "version": 0 },
"update2/index.js": { "version": 2 },
"update2/style2.css": { "version": 2 }
},
"load":[ // Files to insert when bootstrapping app.
"lib/jquery.min.js",
"lib/bluebird.js",
"lib/CordovaPromiseFS.js",
"lib/CordovaAppLoader.js",
"test/test.js",
"update2/index.js",
"update2/style2.css"
]
}
<script type="text/javascript" timeout="5000" manifest="update1/manifest.json" src="bootstrap.js"></script>
manifest.json
is downloaded once. Second time it is retrieved from localStorage.window.BOOTSTRAP_OK = true
to indicate bootstrap was a success.timeout
milliseconds, the manifest in localStorage is deleted and the app reloads the original manifest (and application).Notes:
manifest
attribute should point to a local manifest (i.e. bundled with the app) to guarantee the app can bootstrap even without internet connection.BOOTSTRAP_OK
to true
!check
, download
and update
your app.// Step 3a: Initialize
var fs = new CordovaPromiseFS({});
var loader = window.loader = new CordovaAppLoader({
fs: fs,
localRoot: 'app',
mode: 'mirror'
});
// Step 3b: Check for updates
loader.check().then( ... ) // used `serverRoot` in your `manifest.json`
loader.check('http://yourserver.com/manifest.json').then( ... ) // custom `manifest.json` url
loader.check({ files: { ... } }).then( ... ) // or just check an actual Manifest object.
// Step 3c: Download
loader.download(onprogress).then(function(manifest){},function(failedDownloadUrlArray){ ... });
// Step 4d: Update
loader.update() // reloads page to bootstrap new manifest. Returns true if app will be updated.
Note: When downloading and updating, the new manifest is written to localStorage. The manifest.root
is set to the location of the downloaded files. (Default is ""
- i.e. it loads files relative to your index.html
)
Convert CommonJS to a browser-version:
npm install webpack -g
npm run-script prepublish
Feel free to contribute to this project in any way. The easiest way to support this project is by giving it a star.
© 2014 - Mark Marijnissen
FAQs
Cordova App Loader - remote update your cordova app
The npm package cordova-app-loader receives a total of 4 weekly downloads. As such, cordova-app-loader popularity was classified as not popular.
We found that cordova-app-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.