@feathersjs/transport-commons
Advanced tools
Comparing version 4.0.2 to 4.1.0
# Change Log | ||
## [v4.0.2](https://github.com/feathersjs/transport-commons/tree/v4.0.2) (2018-06-12) | ||
[Full Changelog](https://github.com/feathersjs/transport-commons/compare/v4.0.1...v4.0.2) | ||
**Merged pull requests:** | ||
- Fix looking up invalid path names through sockets [\#76](https://github.com/feathersjs/transport-commons/pull/76) ([daffl](https://github.com/daffl)) | ||
## [v4.0.1](https://github.com/feathersjs/transport-commons/tree/v4.0.1) (2018-05-30) | ||
@@ -4,0 +11,0 @@ [Full Changelog](https://github.com/feathersjs/transport-commons/compare/v4.0.0...v4.0.1) |
@@ -1,3 +0,7 @@ | ||
class Channel { | ||
const { EventEmitter } = require('events'); | ||
class Channel extends EventEmitter { | ||
constructor (connections = [], data = null) { | ||
super(); | ||
this.connections = connections; | ||
@@ -24,2 +28,6 @@ this.data = data; | ||
if (this.length === 0) { | ||
this.emit('empty'); | ||
} | ||
return this; | ||
@@ -26,0 +34,0 @@ } |
@@ -27,3 +27,3 @@ const debug = require('debug')('@feathersjs/transport-commons:channels/mixins'); | ||
if (names.length === 1) { | ||
const name = names[0]; | ||
const [ name ] = names; | ||
@@ -34,4 +34,14 @@ if (Array.isArray(name)) { | ||
return this[CHANNELS][name] || | ||
(this[CHANNELS][name] = new Channel()); | ||
if (!this[CHANNELS][name]) { | ||
const channel = new Channel(); | ||
channel.once('empty', () => { | ||
channel.removeAllListeners(); | ||
delete this[CHANNELS][name]; | ||
}); | ||
this[CHANNELS][name] = channel; | ||
} | ||
return this[CHANNELS][name]; | ||
} | ||
@@ -38,0 +48,0 @@ |
{ | ||
"name": "@feathersjs/transport-commons", | ||
"description": "Shared functionality for websocket providers", | ||
"version": "4.0.2", | ||
"version": "4.1.0", | ||
"homepage": "https://github.com/feathersjs/transport-commons", | ||
@@ -6,0 +6,0 @@ "main": "lib/", |
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
39746
461