leapmotion/leapjs — pull request #35 by Hyzhak (2013-02-28 21:52:18+00:00)
Title: fix bug with disconnected and reconnected LeapMotion

Fix bug with *WebSocket's onclose handler*. And also all behavior with disconnect, reconnect interaction.

# To Reproduce
## 1
Just turn off Leap device and then LeapJS library rise exception:

```
Uncaught TypeError: Object # has no method 'connect' leap.js:1684
```

Because *Connection.prototype.handleClose* function run in scope of *WebSocket*.
So there is little fix for it.

## 2
Also after calling disconnect close handler also going to reconnect.

So i have add *this.connected* flag to store user intention to prevent this behavior.