Files
react-native-code-push/package-mixins.js
2015-09-10 14:38:10 -07:00

29 lines
743 B
JavaScript

var extend = require("extend");
module.exports = (NativeCodePush) => {
var remote = {
download: function download() {
// Use the downloaded package info. Native code will save the package info
// so that the client knows what the current package version is.
return NativeCodePush.downloadUpdate(this)
.then((downloadedPackage) => {
return extend({}, downloadedPackage, local);
});
},
abortDownload: function abortDownload() {
return NativeCodePush.abortDownload(this);
}
};
var local = {
apply: function apply(rollbackTimeout = 0) {
return NativeCodePush.applyUpdate(this, rollbackTimeout);
}
};
return {
remote: remote,
local: local
};
};