diff --git a/src/ol/Collection.js b/src/ol/Collection.js index 194b6d321b..794a9fe8a7 100644 --- a/src/ol/Collection.js +++ b/src/ol/Collection.js @@ -44,6 +44,14 @@ export class CollectionEvent extends Event { } } +/*** + * @typedef {import("./Observable").OnSignature & + * import("./Observable").OnSignature & + * import("./Observable").OnSignature<'add'|'remove', CollectionEvent> & + * import("./Observable").CombinedOnSignature} CollectionOnSignature + */ + /** * @typedef {Object} Options * @property {boolean} [unique=false] Disallow the same item from being added to @@ -72,13 +80,15 @@ class Collection extends BaseObject { super(); /*** - * @type {import("./Observable").OnSignature & - * import("./Observable").OnSignature & - * import("./Observable").OnSignature<'add'|'remove', CollectionEvent> & - * import("./Observable").CombinedOnSignature} + * @type {CollectionOnSignature} */ this.on; + /*** + * @type {CollectionOnSignature} + */ + this.once; + const options = opt_options || {}; /** diff --git a/src/ol/Feature.js b/src/ol/Feature.js index 281b8a45df..9f60f66c18 100644 --- a/src/ol/Feature.js +++ b/src/ol/Feature.js @@ -14,6 +14,13 @@ import {listen, unlistenByKey} from './events.js'; * @typedef {Feature|import("./render/Feature.js").default} FeatureLike */ +/*** + * @typedef {import("./Observable").OnSignature & + * import("./Observable").OnSignature & + * import("./Observable").CombinedOnSignature} FeatureOnSignature + */ + /** * @classdesc * A vector object for geographic features with a geometry and other @@ -70,12 +77,15 @@ class Feature extends BaseObject { super(); /*** - * @type {import("./Observable").OnSignature & - * import("./Observable").OnSignature & - * import("./Observable").CombinedOnSignature} + * @type {FeatureOnSignature} */ this.on; + /*** + * @type {FeatureOnSignature} + */ + this.once; + /** * @private * @type {number|string|undefined} diff --git a/src/ol/Geolocation.js b/src/ol/Geolocation.js index 3f497fae2c..83e7f00b5e 100644 --- a/src/ol/Geolocation.js +++ b/src/ol/Geolocation.js @@ -67,6 +67,14 @@ class GeolocationError extends BaseEvent { * 'change:trackingOptions'} GeolocationObjectEventTypes */ +/*** + * @typedef {import("./Observable").OnSignature & + * import("./Observable").OnSignature & + * import("./Observable").OnSignature<'error', GeolocationError> & + * import("./Observable").CombinedOnSignature} GeolocationOnSignature + */ + /** * @classdesc * Helper class for providing HTML5 Geolocation capabilities. @@ -98,13 +106,15 @@ class Geolocation extends BaseObject { super(); /*** - * @type {import("./Observable").OnSignature & - * import("./Observable").OnSignature & - * import("./Observable").OnSignature<'error', GeolocationError> & - * import("./Observable").CombinedOnSignature} + * @type {GeolocationOnSignature} */ this.on; + /*** + * @type {GeolocationOnSignature} + */ + this.once; + const options = opt_options || {}; /** diff --git a/src/ol/Object.js b/src/ol/Object.js index 59946fcf0e..305155f1bb 100644 --- a/src/ol/Object.js +++ b/src/ol/Object.js @@ -37,6 +37,12 @@ export class ObjectEvent extends Event { } } +/*** + * @typedef {import("./Observable").OnSignature & + * import("./Observable").OnSignature & + * import("./Observable").CombinedOnSignature} ObjectOnSignature + */ + /** * @classdesc * Abstract base class; normally only used for creating subclasses and not @@ -88,12 +94,15 @@ class BaseObject extends Observable { super(); /*** - * @type {import("./Observable").OnSignature & - * import("./Observable").OnSignature & - * import("./Observable").CombinedOnSignature} + * @type {ObjectOnSignature} */ this.on; + /*** + * @type {ObjectOnSignature} + */ + this.once; + // Call {@link module:ol/util.getUid} to ensure that the order of objects' ids is // the same as the order in which they were created. This also helps to // ensure that object properties are always added in the same order, which diff --git a/src/ol/Observable.js b/src/ol/Observable.js index 01a8cc5fa4..a9d7850ba3 100644 --- a/src/ol/Observable.js +++ b/src/ol/Observable.js @@ -40,6 +40,11 @@ class Observable extends EventTarget { */ this.on = this.onInternal; + /*** + * @type {OnSignature} + */ + this.once = this.onceInternal; + /** * @private * @type {number} @@ -87,15 +92,13 @@ class Observable extends EventTarget { } /** - * Listen once for a certain type of event. - * @param {string|Array} type The event type or array of event types. - * @param {function(?): ?} listener The listener function. - * @return {import("./events.js").EventsKey|Array} Unique key for the listener. If - * called with an array of event types as the first argument, the return - * will be an array of keys. - * @api + * @param {string|Array} type Type. + * @param {function(import("./events/Event").default): (void|boolean)} listener Listener. + * @return {import("./events.js").EventsKey|Array} Event key. + * @protected */ - once(type, listener) { + // the jsdoc api annotation follows below the class declaration. + onceInternal(type, listener) { let key; if (Array.isArray(type)) { const len = type.length; @@ -113,7 +116,7 @@ class Observable extends EventTarget { /** * Unlisten for a certain type of event. * @param {string|Array} type The event type or array of event types. - * @param {function(?): ?} listener The listener function. + * @param {function(import("./events/Event").default): (void|boolean)} listener The listener function. * @api */ un(type, listener) { @@ -134,7 +137,7 @@ class Observable extends EventTarget { * Listen for a certain type of event. * @function * @param {string|Array} type The event type or array of event types. - * @param {function(?): ?} listener The listener function. + * @param {function(import("./events/Event").default): (void|boolean)} listener The listener function. * @return {import("./events.js").EventsKey|Array} Unique key for the listener. If * called with an array of event types as the first argument, the return * will be an array of keys. @@ -142,6 +145,18 @@ class Observable extends EventTarget { */ Observable.prototype.on; +/** + * Listen once for a certain type of event. + * @function + * @param {string|Array} type The event type or array of event types. + * @param {function(import("./events/Event").default): (void|boolean)} listener The listener function. + * @return {import("./events.js").EventsKey|Array} Unique key for the listener. If + * called with an array of event types as the first argument, the return + * will be an array of keys. + * @api + */ +Observable.prototype.once; + /** * Removes an event listener using the key returned by `on()` or `once()`. * @param {import("./events.js").EventsKey|Array} key The key returned by `on()` diff --git a/src/ol/Overlay.js b/src/ol/Overlay.js index 5e9bb5fa17..886aba4e39 100644 --- a/src/ol/Overlay.js +++ b/src/ol/Overlay.js @@ -88,6 +88,12 @@ const Property = { * 'change:positioning'} OverlayObjectEventTypes */ +/*** + * @typedef {import("./Observable").OnSignature & + * import("./Observable").OnSignature & + * import("./Observable").CombinedOnSignature} OverlayOnSignature + */ + /** * @classdesc * An element to be displayed over the map and attached to a single map @@ -116,12 +122,15 @@ class Overlay extends BaseObject { super(); /*** - * @type {import("./Observable").OnSignature & - * import("./Observable").OnSignature & - * import("./Observable").CombinedOnSignature} + * @type {OverlayOnSignature} */ this.on; + /*** + * @type {OverlayOnSignature} + */ + this.once; + /** * @protected * @type {Options} diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index 12a55626b4..8f90a35140 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -90,6 +90,17 @@ import {removeNode} from './dom.js'; * @typedef {import("./ObjectEventType").Types|'change:layergroup'|'change:size'|'change:target'|'change:view'} MapObjectEventTypes */ +/*** + * @typedef {import("./Observable").OnSignature & + * import("./Observable").OnSignature & + * import("./Observable").OnSignature & + * import("./Observable").OnSignature & + * import("./Observable").OnSignature & + * import("./Observable").CombinedOnSignature} PluggableMapOnSignature + */ + /** * Object literal with config options for the map. * @typedef {Object} MapOptions @@ -141,16 +152,15 @@ class PluggableMap extends BaseObject { super(); /*** - * @type {import("./Observable").OnSignature & - * import("./Observable").OnSignature & - * import("./Observable").OnSignature & - * import("./Observable").OnSignature & - * import("./Observable").OnSignature & - * import("./Observable").CombinedOnSignature} + * @type {PluggableMapOnSignature} */ this.on; + /*** + * @type {PluggableMapOnSignature} + */ + this.once; + const optionsInternal = createOptionsInternal(options); /** @private */ diff --git a/src/ol/View.js b/src/ol/View.js index ca538080de..72296f715d 100644 --- a/src/ol/View.js +++ b/src/ol/View.js @@ -222,6 +222,12 @@ const DEFAULT_MIN_ZOOM = 0; * @typedef {import("./ObjectEventType").Types|'change:center'|'change:resolution'|'change:rotation'} ViewObjectEventTypes */ +/*** + * @typedef {import("./Observable").OnSignature & + * import("./Observable").OnSignature & + * import("./Observable").CombinedOnSignature} ViewOnSignature + */ + /** * @classdesc * A View object represents a simple 2D view of the map. @@ -302,12 +308,15 @@ class View extends BaseObject { super(); /*** - * @type {import("./Observable").OnSignature & - * import("./Observable").OnSignature & - * import("./Observable").CombinedOnSignature} + * @type {ViewOnSignature} */ this.on; + /*** + * @type {ViewOnSignature} + */ + this.once; + const options = assign({}, opt_options); /** diff --git a/src/ol/control/FullScreen.js b/src/ol/control/FullScreen.js index 69f6626c6b..4c9d76fab8 100644 --- a/src/ol/control/FullScreen.js +++ b/src/ol/control/FullScreen.js @@ -32,6 +32,14 @@ const FullScreenEventType = { LEAVEFULLSCREEN: 'leavefullscreen', }; +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} FullScreenOnSignature + */ + /** * @typedef {Object} Options * @property {string} [className='ol-full-screen'] CSS class name. @@ -81,14 +89,15 @@ class FullScreen extends Control { }); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").CombinedOnSignature} + * @type {FullScreenOnSignature} */ this.on; + /*** + * @type {FullScreenOnSignature} + */ + this.once; + /** * @private * @type {string} diff --git a/src/ol/control/MousePosition.js b/src/ol/control/MousePosition.js index 9e059730a2..a6256c1262 100644 --- a/src/ol/control/MousePosition.js +++ b/src/ol/control/MousePosition.js @@ -22,6 +22,14 @@ const PROJECTION = 'projection'; */ const COORDINATE_FORMAT = 'coordinateFormat'; +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} MousePositionOnSignature + */ + /** * @typedef {Object} Options * @property {string} [className='ol-mouse-position'] CSS class name. @@ -69,14 +77,15 @@ class MousePosition extends Control { }); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").CombinedOnSignature} + * @type {MousePositionOnSignature} */ this.on; + /*** + * @type {MousePositionOnSignature} + */ + this.once; + this.addChangeListener(PROJECTION, this.handleProjectionChanged_); if (options.coordinateFormat) { diff --git a/src/ol/control/ScaleLine.js b/src/ol/control/ScaleLine.js index 500824ebfd..1881181215 100644 --- a/src/ol/control/ScaleLine.js +++ b/src/ol/control/ScaleLine.js @@ -37,6 +37,14 @@ const LEADING_DIGITS = [1, 2, 5]; */ const DEFAULT_DPI = 25.4 / 0.28; +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} ScaleLineOnSignature + */ + /** * @typedef {Object} Options * @property {string} [className='ol-scale-line'] CSS Class name. @@ -91,13 +99,15 @@ class ScaleLine extends Control { }); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").CombinedOnSignature} + * @type {ScaleLineOnSignature} */ this.on; + /*** + * @type {ScaleLineOnSignature} + */ + this.once; + /** * @private * @type {HTMLElement} diff --git a/src/ol/interaction/DragBox.js b/src/ol/interaction/DragBox.js index f4d9448741..5aa37b5595 100644 --- a/src/ol/interaction/DragBox.js +++ b/src/ol/interaction/DragBox.js @@ -93,6 +93,15 @@ export class DragBoxEvent extends Event { } } +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature<'boxcancel'|'boxdrag'|'boxend', DragBoxEvent> & + * import("../Observable").CombinedOnSignature} DragBoxOnSignature + */ + /** * @classdesc * Allows the user to draw a vector box by clicking and dragging on the map, @@ -113,15 +122,15 @@ class DragBox extends PointerInteraction { super(); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").OnSignature<'boxcancel'|'boxdrag'|'boxend', DragBoxEvent> & - * import("../Observable").CombinedOnSignature} + * @type {DragBoxOnSignature} */ this.on; + /*** + * @type {DragBoxOnSignature} + */ + this.once; + const options = opt_options ? opt_options : {}; /** diff --git a/src/ol/interaction/Draw.js b/src/ol/interaction/Draw.js index efff5a60b7..42787f6ffc 100644 --- a/src/ol/interaction/Draw.js +++ b/src/ol/interaction/Draw.js @@ -172,6 +172,15 @@ export class DrawEvent extends Event { } } +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature<'drawabort'|'drawend'|'drawstart', DrawEvent> & + * import("../Observable").CombinedOnSignature} DrawOnSignature + */ + /** * @classdesc * Interaction for drawing feature geometries. @@ -194,15 +203,15 @@ class Draw extends PointerInteraction { super(pointerOptions); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").OnSignature<'drawabort'|'drawend'|'drawstart', DrawEvent> & - * import("../Observable").CombinedOnSignature} + * @type {DrawOnSignature} */ this.on; + /*** + * @type {DrawOnSignature} + */ + this.once; + /** * @type {boolean} * @private diff --git a/src/ol/interaction/Extent.js b/src/ol/interaction/Extent.js index 12bfa3f48c..040a6c7465 100644 --- a/src/ol/interaction/Extent.js +++ b/src/ol/interaction/Extent.js @@ -74,6 +74,15 @@ export class ExtentEvent extends Event { } } +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature<'extentchanged', ExtentEvent> & + * import("../Observable").CombinedOnSignature} ExtentOnSignature + */ + /** * @classdesc * Allows the user to draw a vector box by clicking and dragging on the map. @@ -93,15 +102,15 @@ class Extent extends PointerInteraction { super(/** @type {import("./Pointer.js").Options} */ (options)); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").OnSignature<'extentchanged', ExtentEvent> & - * import("../Observable").CombinedOnSignature} + * @type {ExtentOnSignature} */ this.on; + /*** + * @type {ExtentOnSignature} + */ + this.once; + /** * Condition * @type {import("../events/condition.js").Condition} diff --git a/src/ol/interaction/Interaction.js b/src/ol/interaction/Interaction.js index 14018d73ee..050d9247be 100644 --- a/src/ol/interaction/Interaction.js +++ b/src/ol/interaction/Interaction.js @@ -5,6 +5,14 @@ import BaseObject from '../Object.js'; import InteractionProperty from './Property.js'; import {easeOut, linear} from '../easing.js'; +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} InteractionOnSignature + */ + /** * Object literal with config options for interactions. * @typedef {Object} InteractionOptions @@ -37,13 +45,15 @@ class Interaction extends BaseObject { super(); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").CombinedOnSignature} + * @type {InteractionOnSignature} */ this.on; + /*** + * @type {InteractionOnSignature} + */ + this.once; + if (opt_options && opt_options.handleEvent) { this.handleEvent = opt_options.handleEvent; } diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index ae2f25890c..61dceaaccc 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -164,6 +164,15 @@ export class ModifyEvent extends Event { } } +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature<'modifyend'|'modifystart', ModifyEvent> & + * import("../Observable").CombinedOnSignature} ModifyOnSignature + */ + /** * @classdesc * Interaction for modifying feature geometries. To modify features that have @@ -193,15 +202,15 @@ class Modify extends PointerInteraction { super(/** @type {import("./Pointer.js").Options} */ (options)); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").OnSignature<'modifyend'|'modifystart', ModifyEvent> & - * import("../Observable").CombinedOnSignature} + * @type {ModifyOnSignature} */ this.on; + /*** + * @type {ModifyOnSignature} + */ + this.once; + /** @private */ this.boundHandleFeatureChange_ = this.handleFeatureChange_.bind(this); diff --git a/src/ol/interaction/Select.js b/src/ol/interaction/Select.js index 2b08c999f8..a1cf2801ce 100644 --- a/src/ol/interaction/Select.js +++ b/src/ol/interaction/Select.js @@ -134,6 +134,15 @@ export class SelectEvent extends Event { */ const originalFeatureStyles = {}; +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature<'select', SelectEvent> & + * import("../Observable").CombinedOnSignature} SelectOnSignature + */ + /** * @classdesc * Interaction for selecting vector features. By default, selected features are @@ -157,15 +166,15 @@ class Select extends Interaction { super(); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").OnSignature<'select', SelectEvent> & - * import("../Observable").CombinedOnSignature} + * @type {SelectOnSignature} */ this.on; + /*** + * @type {SelectOnSignature} + */ + this.once; + const options = opt_options ? opt_options : {}; /** diff --git a/src/ol/interaction/Translate.js b/src/ol/interaction/Translate.js index ae24550198..2da2459159 100644 --- a/src/ol/interaction/Translate.js +++ b/src/ol/interaction/Translate.js @@ -110,6 +110,15 @@ export class TranslateEvent extends Event { } } +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature<'translateend'|'translatestart'|'translating', TranslateEvent> & + * import("../Observable").CombinedOnSignature} TranslateOnSignature + */ + /** * @classdesc * Interaction for translating (moving) features. @@ -127,15 +136,15 @@ class Translate extends PointerInteraction { super(/** @type {import("./Pointer.js").Options} */ (options)); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").OnSignature<'translateend'|'translatestart'|'translating', TranslateEvent> & - * import("../Observable").CombinedOnSignature} + * @type {TranslateOnSignature} */ this.on; + /*** + * @type {TranslateOnSignature} + */ + this.once; + /** * The last position we translated to. * @type {import("../coordinate.js").Coordinate} diff --git a/src/ol/layer/Base.js b/src/ol/layer/Base.js index 0cb6b4c5aa..d72df54126 100644 --- a/src/ol/layer/Base.js +++ b/src/ol/layer/Base.js @@ -13,6 +13,12 @@ import {clamp} from '../math.js'; * 'change:minResolution'|'change:minZoom'|'change:opacity'|'change:visible'|'change:zIndex'} BaseLayerObjectEventTypes */ +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} BaseLayerOnSignature + */ + /** * @typedef {Object} Options * @property {string} [className='ol-layer'] A CSS class name to set to the layer element. @@ -53,12 +59,15 @@ class BaseLayer extends BaseObject { super(); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").CombinedOnSignature} + * @type {BaseLayerOnSignature} */ this.on; + /*** + * @type {BaseLayerOnSignature} + */ + this.once; + /** * @type {Object} */ diff --git a/src/ol/layer/BaseTile.js b/src/ol/layer/BaseTile.js index 2ce0b5ca1a..38ebab5937 100644 --- a/src/ol/layer/BaseTile.js +++ b/src/ol/layer/BaseTile.js @@ -5,6 +5,15 @@ import Layer from './Layer.js'; import TileProperty from './TileProperty.js'; import {assign} from '../obj.js'; +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} BaseTileLayerOnSignature + */ + /** * @template {import("../source/Tile.js").default} TileSourceType * @typedef {Object} Options @@ -62,15 +71,15 @@ class BaseTileLayer extends Layer { super(baseOptions); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").CombinedOnSignature} + * @type {BaseTileLayerOnSignature} */ this.on; + /*** + * @type {BaseTileLayerOnSignature} + */ + this.once; + this.setPreload(options.preload !== undefined ? options.preload : 0); this.setUseInterimTilesOnError( options.useInterimTilesOnError !== undefined diff --git a/src/ol/layer/Layer.js b/src/ol/layer/Layer.js index 0b2ae86643..f275621a4e 100644 --- a/src/ol/layer/Layer.js +++ b/src/ol/layer/Layer.js @@ -14,6 +14,15 @@ import {listen, unlistenByKey} from '../events.js'; * @typedef {function(import("../PluggableMap.js").FrameState):HTMLElement} RenderFunction */ +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} LayerOnSignature + */ + /** * @template {import("../source/Source.js").default} SourceType * @typedef {Object} Options @@ -97,15 +106,15 @@ class Layer extends BaseLayer { super(baseOptions); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").CombinedOnSignature} + * @type {LayerOnSignature} */ this.on; + /*** + * @type {LayerOnSignature} + */ + this.once; + /** * @private * @type {?import("../events.js").EventsKey} diff --git a/src/ol/layer/VectorTile.js b/src/ol/layer/VectorTile.js index e0e9f9a2e7..d44df4c0bc 100644 --- a/src/ol/layer/VectorTile.js +++ b/src/ol/layer/VectorTile.js @@ -8,6 +8,15 @@ import VectorTileRenderType from './VectorTileRenderType.js'; import {assert} from '../asserts.js'; import {assign} from '../obj.js'; +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} VectorTileLayerOnSignature + */ + /** * @typedef {Object} Options * @property {string} [className='ol-layer'] A CSS class name to set to the layer element. @@ -96,15 +105,15 @@ class VectorTileLayer extends BaseVectorLayer { ); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").CombinedOnSignature} + * @type {VectorTileLayerOnSignature} */ this.on; + /*** + * @type {VectorTileLayerOnSignature} + */ + this.once; + if (options.renderMode === VectorTileRenderType.IMAGE) { //FIXME deprecated - remove this check in v7. //eslint-disable-next-line diff --git a/src/ol/source/Image.js b/src/ol/source/Image.js index 354baa9638..21a46ca923 100644 --- a/src/ol/source/Image.js +++ b/src/ol/source/Image.js @@ -64,6 +64,14 @@ export class ImageSourceEvent extends Event { } } +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} ImageSourceOnSignature + */ + /** * @typedef {Object} Options * @property {import("./Source.js").AttributionLike} [attributions] Attributions. @@ -94,13 +102,15 @@ class ImageSource extends Source { }); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").CombinedOnSignature} + * @type {ImageSourceOnSignature} */ this.on; + /*** + * @type {ImageSourceOnSignature} + */ + this.once; + /** * @private * @type {Array} diff --git a/src/ol/source/Tile.js b/src/ol/source/Tile.js index 868aa61b65..06f31a7e16 100644 --- a/src/ol/source/Tile.js +++ b/src/ol/source/Tile.js @@ -15,6 +15,14 @@ import { } from '../tilegrid.js'; import {scale as scaleSize, toSize} from '../size.js'; +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} TileSourceOnSignature + */ + /** * @typedef {Object} Options * @property {import("./Source.js").AttributionLike} [attributions] Attributions. @@ -53,14 +61,15 @@ class TileSource extends Source { }); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").CombinedOnSignature} + * @type {TileSourceOnSignature} */ this.on; + /*** + * @type {TileSourceOnSignature} + */ + this.once; + /** * @private * @type {boolean} diff --git a/src/ol/source/Vector.js b/src/ol/source/Vector.js index 346c459730..e3d5b12737 100644 --- a/src/ol/source/Vector.js +++ b/src/ol/source/Vector.js @@ -61,6 +61,14 @@ export class VectorSourceEvent extends Event { } } +/*** + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} VectorSourceOnSignature + */ + /** * @typedef {Object} Options * @property {import("./Source.js").AttributionLike} [attributions] Attributions. @@ -178,14 +186,15 @@ class VectorSource extends Source { }); /*** - * @type {import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").OnSignature & - * import("../Observable").CombinedOnSignature} + * @type {VectorSourceOnSignature} */ this.on; + /*** + * @type {VectorSourceOnSignature} + */ + this.once; + /** * @private * @type {import("../featureloader.js").FeatureLoader}