nathankellenicki / nuimojs

Nuimo.js - A Node.js library for interacting with Nuimo devices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Undefined enum

blmarket opened this issue · comments

nuimojs/src/device.js:180
            case (Nuimo.Direction.LEFT):
                                 ^

TypeError: Cannot read property 'LEFT' of undefined

you should export Direction at nuimo.js

Hi, which version of Node are you using? The export of nuimo.js is the Nuimo class, for which there is a static getter for the Direction enum. I'm not able to reproduce this.

Reproduction step is not clear enough, sorry about that. it was

  1. run examples/interaction.js
  2. swipe nuimo to left
  3. bang!

Last test was on node version v6.3.0.

$ node -v
v6.3.0

My analysis is here.

As nuimo.js and device.js are in circular dependency, so Nuimo.Direction is undefined when device.js is trying to import it. you better remove those circular dependencies.

Created PR #4 to fix, PTAL

Thank you, tested and works! Merged.

😀 eager waiting next release!