Skip to content

Commit 634c8a8

Browse files
committed
offline online detection code added
1 parent d278df8 commit 634c8a8

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

www/js/appRun.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
define(['app'], function(app){
2+
'use strict';
3+
4+
// once application is up, this listener will be triggered
5+
app.run(['localeService','$auth', '$rootScope', '$window', function(localeService, $auth, $rootScope, $window) {
6+
$auth.setStorageType('localStorage');
7+
localeService.setDefault();
8+
9+
$window.addEventListener("online", function(){
10+
$rootScope.$digest();
11+
});
12+
13+
$window.addEventListener("offline", function(){
14+
$rootScope.$digest();
15+
});
16+
17+
}]);
18+
});

www/js/bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
define(['jquery', 'app', 'routes'], function ($, app) {
1+
define(['jquery', 'app', 'routes','appRun'], function ($, app) {
22
'use strict';
33

44
var $document = $(document),

www/js/routes.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,4 @@ define(['app'], function (app) {
125125
template: "<i class='icon ion-loading-b'></i>"
126126
});
127127

128-
// once application is up, this listener will be triggered
129-
app.run(['localeService','$auth', function(localeService, $auth) {
130-
$auth.setStorageType('localStorage');
131-
localeService.setDefault();
132-
}]);
133-
134128
});

0 commit comments

Comments
 (0)