Files
react-native-code-push/RestartManager.js
2016-05-22 18:41:07 +02:00

34 lines
614 B
JavaScript

let NativeCodePush = require("react-native").NativeModules.CodePush;
const RestartManager = (() => {
let _allowed = true;
function restartApp(onlyIfUpdateIsPending = false) {
if (_allowed) {
NativeCodePush.restartApp(onlyIfUpdateIsPending);
}
}
function allow() {
_allowed = true;
restartApp(true);
}
function allowed() {
return _allowed
}
function disallow() {
_allowed = false;
}
return {
allow,
disallow,
allowed,
restartApp,
};
})();
module.exports = RestartManager;