From a6e17318d3b8fa9698a47cb501ca1588c0845eba Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 7 Feb 2017 08:37:39 +0100 Subject: [PATCH] Remove ol.Observable#unByKey --- changelog/upgrade-notes.md | 11 +++++++++++ src/ol/observable.js | 12 ------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/changelog/upgrade-notes.md b/changelog/upgrade-notes.md index 60bc32d2f6..5ad22c71b8 100644 --- a/changelog/upgrade-notes.md +++ b/changelog/upgrade-notes.md @@ -6,6 +6,17 @@ The deprecated `ol.animation` functions and `map.beforeRender()` method have been removed. Use `view.animate()` instead. +The `unByKey()` method has been removed from `ol.Observable` instances. Use the `ol.Observable.unByKey()` static function instead. +```js +var key = map.on('moveend', function() { ...}); +map.unByKey(key); +``` +New code: +```js +var key = map.on('moveend', function() { ...}); +ol.Observable.unByKey(key); +``` + #### Simplified `ol.View#fit()` API In most cases, it is no longer necessary to provide an `ol.Size` (previously the 2nd argument) to `ol.View#fit()`. By default, the size of the first map that uses the view will be used. If you want to specify a different size, it goes in the options now (previously the 3rd argument, now the 2nd). diff --git a/src/ol/observable.js b/src/ol/observable.js index 3a6af009b9..f0bde381c4 100644 --- a/src/ol/observable.js +++ b/src/ol/observable.js @@ -154,15 +154,3 @@ ol.Observable.prototype.un = function(type, listener, opt_this) { ol.events.unlisten(this, /** @type {string} */ (type), listener, opt_this); } }; - - -/** - * Removes an event listener using the key returned by `on()` or `once()`. - * Note that using the {@link ol.Observable.unByKey} static function is to - * be preferred. - * @param {ol.EventsKey|Array.} key The key returned by `on()` - * or `once()` (or an array of keys). - * @function - * @api - */ -ol.Observable.prototype.unByKey = ol.Observable.unByKey;