@logux/core
Advanced tools
Comparing version 0.8.4 to 0.8.5
{ | ||
"name": "@logux/core", | ||
"version": "0.8.4", | ||
"version": "0.8.5", | ||
"description": "Logux core components", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -23,2 +23,3 @@ const DEFAULT_OPTIONS = { | ||
this.reconnecting = connection.connected | ||
this.beforeFreeze = null | ||
this.connecting = false | ||
@@ -59,3 +60,14 @@ this.attempts = 0 | ||
} | ||
let disconnect = () => { | ||
let resume = () => { | ||
if (this.beforeFreeze !== null) { | ||
this.reconnecting = this.beforeFreeze | ||
this.beforeFreeze = null | ||
} | ||
connect() | ||
} | ||
let freeze = () => { | ||
if (this.beforeFreeze === null) { | ||
this.beforeFreeze = this.reconnecting | ||
this.reconnecting = false | ||
} | ||
this.disconnect('freeze') | ||
@@ -72,4 +84,4 @@ } | ||
window.addEventListener('online', connect, false) | ||
window.addEventListener('resume', connect, false) | ||
window.addEventListener('freeze', disconnect, false) | ||
window.addEventListener('resume', resume, false) | ||
window.addEventListener('freeze', freeze, false) | ||
this.unbind.push(() => { | ||
@@ -79,4 +91,4 @@ document.removeEventListener('visibilitychange', visibility, false) | ||
window.removeEventListener('online', connect, false) | ||
window.removeEventListener('resume', connect, false) | ||
window.removeEventListener('freeze', disconnect, false) | ||
window.removeEventListener('resume', resume, false) | ||
window.removeEventListener('freeze', freeze, false) | ||
}) | ||
@@ -83,0 +95,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104123
3577