@logux/core
Advanced tools
+14
-3
@@ -5,2 +5,3 @@ import { createNanoEvents } from 'nanoevents' | ||
| constructor(pair, type) { | ||
| this.connecting = false | ||
| this.connected = false | ||
@@ -16,7 +17,13 @@ this.emitter = createNanoEvents() | ||
| } else { | ||
| this.connecting = true | ||
| this.emitter.emit('connecting') | ||
| return new Promise(resolve => { | ||
| setTimeout(() => { | ||
| if (!this.connecting) { | ||
| resolve() | ||
| return | ||
| } | ||
| this.other().connected = true | ||
| this.connected = true | ||
| this.connecting = false | ||
| this.other().emitter.emit('connect') | ||
@@ -31,5 +38,7 @@ this.emitter.emit('connect') | ||
| disconnect(reason) { | ||
| if (!this.connected) { | ||
| throw new Error('Connection already finished') | ||
| } else { | ||
| if (this.connecting) { | ||
| this.connecting = false | ||
| this.emitter.emit('disconnect', reason) | ||
| return Promise.resolve() | ||
| } else if (this.connected) { | ||
| this.connected = false | ||
@@ -44,2 +53,4 @@ this.emitter.emit('disconnect', reason) | ||
| }) | ||
| } else { | ||
| throw new Error('Connection already finished') | ||
| } | ||
@@ -46,0 +57,0 @@ } |
+1
-1
| { | ||
| "name": "@logux/core", | ||
| "version": "0.8.2", | ||
| "version": "0.8.3", | ||
| "description": "Logux core components", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
103893
0.31%3565
0.31%