fix adding root namespace to lookups

master
David Kebler 2018-05-28 14:18:20 -07:00
parent 10077e207b
commit 20d2eb09cc
4 changed files with 8 additions and 5 deletions

View File

@ -2,3 +2,7 @@ tests/
test/ test/
*.test.js *.test.js
testing/ testing/
examples/
*.lock
.eslintrc.js
.travis.yml

View File

@ -1,6 +1,6 @@
{ {
"name": "@uci/base", "name": "@uci/base",
"version": "0.1.6", "version": "0.1.7",
"description": "Multi type and transport JSON packet communication base class. Used in UCI extended classes", "description": "Multi type and transport JSON packet communication base class. Used in UCI extended classes",
"main": "src/base", "main": "src/base",
"scripts": { "scripts": {

View File

@ -27,8 +27,8 @@ export default class Base extends EventEmitter {
this._defaultCmds = commands this._defaultCmds = commands
this._namespaces = namespaces this._namespaces = namespaces
if (opts.useRootNS) { // add root of instance to checking for command functions - not recommended! if (opts.useRootNS) { // add root of instance to checking for command functions - not recommended!
this._namespaces.s.push(null) this._namespaces.s.splice(-1,0,null)
this._namespaces.c.push(null) this._namespaces.c.splice(-1,0,null)
} }
this.bindFuncs = bindFuncs this.bindFuncs = bindFuncs
// predefined sockets: // predefined sockets:
@ -217,7 +217,7 @@ export default class Base extends EventEmitter {
consumersProcessor(func) { consumersProcessor(func) {
for(let name of Object.keys(this.socket)){ for(let name of Object.keys(this.socket)){
if (this.socket[name].type ==='c') { if (this.socket[name].type ==='c') {
this.socketNamedProcessor(func,name) this.socketNameProcessor(func,name)
} }
} }
} }

1
test/.gitignore vendored
View File

@ -1 +0,0 @@
/node_modules/