openlayers/ol3 — pull request #2794 by elemoine (2014-10-03 14:52:15+00:00)
Title: Add ol.Observable.unByKey

Today we have `ol.Observable.prototype.unByKey`:

```js

/**
* Removes an event listener using the key returned by `on()` or `once()`.
* @param {goog.events.Key} key Key.
* @api stable
*/
ol.Observable.prototype.unByKey = function(key) {
goog.events.unlistenByKey(key);
};
```

So it is a method wrapping a static function. That means it could instead be static:

```js

/**
* Removes an event listener using the key returned by `on()` or `once()`.
* @param {goog.events.Key} key Key.
* @api stable
*/
ol.Observable.unByKey = function(key) {
goog.events.unlistenByKey(key);
};
```

Having a static function (`ol.Observable.unByKey`) would be more convenient. Because when it is the time to unregister your listeners you may not have a reference to the object you registered your listeners on. You may even have an array of listener ids for listeners on multiple observables.

Please review.

We could also consider `@deprecate`'ing `ol.Observable.prototype.unByKey`.