1.0.0-alpha.2 • Published 8 years ago
@blinkmobile/evergreen-sdk v1.0.0-alpha.2
Evergreen updater

A Module to handle getting and using an evergreen update made with the Blink Buildbots
Installation
npm i --save @blinkmobile/evergreen-sdk
Prerequisites
- Apache Cordova
- ionic-plugin-deploy
Usage
For iOS < 10 and older Android projects dist/bm-evergreen-updater-legacy.js should be used. This includes the WhatWG fetch pollyfil and is transpiled from ES6 to ES5. ES6 builds using import will include src/evergreen-updater.js
You must make sure the deviceready event from cordova has fired before using this plugin
const EvergreenUpdater = require('@blinkmobile/evergreen-sdk')
document.addEventListener('deviceready', function () {
const eu = new EvergreenUpdater({ appId: 'appId', tenantId: 'blinkTenantId' })
eu.check().then((updateAvailable) => {
if (updateAvailable) {
return eu.download().then(() => eu.restart())
}
})
})API
Constructor (options: object)
options.appId: Your Cordova app id fromconfig.xmloptions.tenantId: Your Blink Mobile Tenant Idoptions.ionicDeploy: The Ionic Deploy plugin (optional, will use window.IonicDeploy if not specified)options.platformId: The cordova platform id (optional, will use cordova.platformId if not specified)
check () => Promise<boolean>
Resolves with true if an update is available, false if not
download (progressCB: function(stage: string, progress: number)) => Promise<void>
progressCB: called whenever Ionic Deploy reports progress.stagewill be one of 'download' or 'extract',progressis the percent complete for that particular stage
Resolves on successful download, rejects if an error occurred
restart () => void
Applies the update and restarts the app
1.0.0-alpha.2
8 years ago
1.0.0-alpha.1
8 years ago