Event listeners are broken
Closed this issue · 3 comments
nicokaiser commented
Adding event listeners with addEventListener is broken.
In api.js, e.g. eventType is not defined (must be "type"?).
addEventListener: function(type, listener, useCapture) {
this._listeners = this._listeners || {};
var list = this._listeners[eventType] = this._listeners[eventType] || [];
list.push(listener);
},
And, the behavior of listeners added with addEventListener seems to be different from on... function:
conn.onmessage = function(event) {
console.log(event.data);
}
conn.addEventListener('message', function(event) {
// event is undefined here
}
This should be consistent.
jcoglan commented
Thanks -- looks like I refactored something a little too hastily. Will fix later today.
jcoglan commented
Fix now released to npm
in version 0.1.1.