Skip to content

Instantly share code, notes, and snippets.

@maxkatz
Last active February 13, 2016 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save maxkatz/76eca6a9508edd448689 to your computer and use it in GitHub Desktop.
Save maxkatz/76eca6a9508edd448689 to your computer and use it in GitHub Desktop.
Check if Appery.io app is online or offline
// Check online or offline
Apperyio.get("AppClientGeneralOperations").getState().then(function(state) {
if (state === "online")
$scope.appState = true;
else
$scope.appState = false;
console.log(state);
});
// Toggle online/offline mode
if ($scope.appState) {
Apperyio.get("AppClientGeneralOperations").goOffline().then(function(state) {
$scope.appState = false;
console.log(state);
});
} else {
Apperyio.get("AppClientGeneralOperations").goOnline().then(function(state) {
$scope.appState = true;
console.log(state);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment