Test
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
window.networkStatus = {
|
||||
dotNetHelper: null,
|
||||
initialize: function (dotNetHelper) {
|
||||
this.dotNetHelper = dotNetHelper;
|
||||
window.addEventListener('online', this.handleStatusChange.bind(this));
|
||||
window.addEventListener('offline', this.handleStatusChange.bind(this));
|
||||
return navigator.onLine;
|
||||
},
|
||||
handleStatusChange: function () {
|
||||
if (this.dotNetHelper) {
|
||||
this.dotNetHelper.invokeMethodAsync('SetOnlineStatus', navigator.onLine);
|
||||
}
|
||||
},
|
||||
isOnline: function () {
|
||||
return navigator.onLine;
|
||||
},
|
||||
dispose: function () {
|
||||
window.removeEventListener('online', this.handleStatusChange.bind(this));
|
||||
window.removeEventListener('offline', this.handleStatusChange.bind(this));
|
||||
this.dotNetHelper = null;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user