new Service($document, $window, $timeout, $rootScope, ngeoOfflineTestUrl)
This service watches the status of network connection.
Currently it watches every $http and $.ajax requests errors, if an error occurs we wait 2 sec then we make an http request on the checker file. If the checker responds that means we are online, otherwise we make a 2nd request 2 sec later, if the 2nd requests failed that means we are offline.
A timeout of 1 sec is set for the checker file, so if we have a bad connection, we consider we are offline.
During offline mode we test every 2 sec if we are back online.
Parameters:
Name | Type | Description |
---|---|---|
$document |
!jQuery | Angular document service. |
$window |
angular.$window | Angular window service. |
$timeout |
!angular.$timeout | Angular timeout service. |
$rootScope |
angular.Scope | The root scope. |
ngeoOfflineTestUrl |
string | Url of the test page. |
Methods
check([timeout]opt)
Check fir network status
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
[timeout] |
number= |
<optional> |
Delay for timeout. |
isDisconnected()
Returns:
boolean
True if we are disconnected.