Named exports from ol/Observable
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import Observable from '../src/ol/Observable.js';
|
||||
import {unByKey} from '../src/ol/Observable.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import {defaults as defaultControls} from '../src/ol/control.js';
|
||||
import {easeOut} from '../src/ol/easing.js';
|
||||
@@ -80,7 +80,7 @@ function flash(feature) {
|
||||
vectorContext.setStyle(style);
|
||||
vectorContext.drawGeometry(flashGeom);
|
||||
if (elapsed > duration) {
|
||||
Observable.unByKey(listenerKey);
|
||||
unByKey(listenerKey);
|
||||
return;
|
||||
}
|
||||
// tell OpenLayers to continue postcompose animation
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import Observable from '../src/ol/Observable.js';
|
||||
import {unByKey} from '../src/ol/Observable.js';
|
||||
import Overlay from '../src/ol/Overlay.js';
|
||||
import {getArea, getLength} from '../src/ol/sphere.js';
|
||||
import View from '../src/ol/View.js';
|
||||
@@ -238,7 +238,7 @@ function addInteraction() {
|
||||
// unset tooltip so that a new one can be created
|
||||
measureTooltipElement = null;
|
||||
createMeasureTooltip();
|
||||
Observable.unByKey(listener);
|
||||
unByKey(listener);
|
||||
}, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ inherits(Observable, EventTarget);
|
||||
* or `once()` (or an array of keys).
|
||||
* @api
|
||||
*/
|
||||
Observable.unByKey = function(key) {
|
||||
export function unByKey(key) {
|
||||
if (Array.isArray(key)) {
|
||||
for (let i = 0, ii = key.length; i < ii; ++i) {
|
||||
unlistenByKey(key[i]);
|
||||
@@ -49,7 +49,7 @@ Observable.unByKey = function(key) {
|
||||
} else {
|
||||
unlistenByKey(/** @type {ol.EventsKey} */ (key));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import EventTarget from '../../../src/ol/events/EventTarget.js';
|
||||
import Observable from '../../../src/ol/Observable.js';
|
||||
import Observable, {unByKey} from '../../../src/ol/Observable.js';
|
||||
|
||||
|
||||
describe('ol.Observable', function() {
|
||||
@@ -138,7 +138,7 @@ describe('ol.Observable', function() {
|
||||
observable.dispatchEvent('foo');
|
||||
expect(listener.calledOnce).to.be(true);
|
||||
|
||||
Observable.unByKey(key);
|
||||
unByKey(key);
|
||||
observable.dispatchEvent('foo');
|
||||
expect(listener.callCount).to.be(1);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import BingMaps from '../../../../src/ol/source/BingMaps.js';
|
||||
import {quadKey} from '../../../../src/ol/tilecoord.js';
|
||||
import Observable from '../../../../src/ol/Observable.js';
|
||||
import {unByKey} from '../../../../src/ol/Observable.js';
|
||||
|
||||
|
||||
describe('ol.source.BingMaps', function() {
|
||||
@@ -24,7 +24,7 @@ describe('ol.source.BingMaps', function() {
|
||||
|
||||
const key = source.on('change', function() {
|
||||
if (source.getState() === 'ready') {
|
||||
Observable.unByKey(key);
|
||||
unByKey(key);
|
||||
tileGrid = source.getTileGrid();
|
||||
done();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Source from '../../../../src/ol/source/Source.js';
|
||||
import TileJSON from '../../../../src/ol/source/TileJSON.js';
|
||||
import Observable from '../../../../src/ol/Observable.js';
|
||||
import {unByKey} from '../../../../src/ol/Observable.js';
|
||||
|
||||
|
||||
describe('ol.source.TileJSON', function() {
|
||||
@@ -115,7 +115,7 @@ describe('ol.source.TileJSON', function() {
|
||||
});
|
||||
const key = source.on('change', function() {
|
||||
if (source.getState() === 'ready') {
|
||||
Observable.unByKey(key);
|
||||
unByKey(key);
|
||||
tileGrid = source.getTileGrid();
|
||||
done();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user