Wallet/src/js/services/applicationService.js

25 lines
679 B
JavaScript
Raw Normal View History

2015-03-06 12:00:10 -03:00
'use strict';
angular.module('copayApp.services')
2015-04-17 13:01:02 -03:00
.factory('applicationService', function($rootScope, $timeout, isCordova, isChromeApp) {
2015-03-06 12:00:10 -03:00
var root = {};
2015-06-11 12:53:38 -03:00
root.restart = function() {
var hashIndex = window.location.href.indexOf('#/');
2015-03-06 12:00:10 -03:00
if (isCordova) {
2015-06-11 12:53:38 -03:00
window.location = window.location.href.substr(0, hashIndex);
2015-03-06 12:00:10 -03:00
$timeout(function() {
$rootScope.$digest();
}, 1);
} else {
// Go home reloading the application
2015-04-17 13:01:02 -03:00
if (isChromeApp) {
chrome.runtime.reload();
} else {
window.location = window.location.href.substr(0, hashIndex);
}
2015-03-06 12:00:10 -03:00
}
};
return root;
});