seanmonstar/Shipyard — Issue #4: Events interface
Author: seanmonstar
Created: 2011-10-21 20:12:01+00:00
State: open

Currently, the `Events` class is from MooTools 1.x. However, I somewhat question the API. `addEvent` and `removeEvent` seem somewhat poorly named, since you're not actually adding or removing events, but `Listeners`. Also, while it's how the spec works, it's inconvenient to hold onto the original function instance in order to remove it later, since they're often anonymous functions, or setup using `Function.prototype.bind`.

As is being considered in MooTools 2.0, I propose that the names be changed to something like `addListener` and `removeListener`, and that they return `Listener` objects, that easily provide `attach` and `detach` methods for later removal and re-adding.

Plus, the name `Events` seems wrong to me. It's not an object of multiple events. It's an `EventEmitter`.

/cc @pennyfx @zalun @csuwldcat