diff --git a/src/ol/Collection.js b/src/ol/Collection.js index 286f17d1ca..15c51f866b 100644 --- a/src/ol/Collection.js +++ b/src/ol/Collection.js @@ -81,12 +81,12 @@ class Collection extends BaseObject { super(); /*** - * @type {CollectionOnSignature} + * @type {CollectionOnSignature} */ this.on; /*** - * @type {CollectionOnSignature} + * @type {CollectionOnSignature} */ this.once; diff --git a/src/ol/Feature.js b/src/ol/Feature.js index 42e2f46851..4bfb5401de 100644 --- a/src/ol/Feature.js +++ b/src/ol/Feature.js @@ -83,12 +83,12 @@ class Feature extends BaseObject { super(); /*** - * @type {FeatureOnSignature} + * @type {FeatureOnSignature} */ this.on; /*** - * @type {FeatureOnSignature} + * @type {FeatureOnSignature} */ this.once; diff --git a/src/ol/Geolocation.js b/src/ol/Geolocation.js index e9a2668f53..44183fcb7b 100644 --- a/src/ol/Geolocation.js +++ b/src/ol/Geolocation.js @@ -107,12 +107,12 @@ class Geolocation extends BaseObject { super(); /*** - * @type {GeolocationOnSignature} + * @type {GeolocationOnSignature} */ this.on; /*** - * @type {GeolocationOnSignature} + * @type {GeolocationOnSignature} */ this.once; diff --git a/src/ol/Object.js b/src/ol/Object.js index 37f5bc9cb1..c5ef7ef757 100644 --- a/src/ol/Object.js +++ b/src/ol/Object.js @@ -95,12 +95,12 @@ class BaseObject extends Observable { super(); /*** - * @type {ObjectOnSignature} + * @type {ObjectOnSignature} */ this.on; /*** - * @type {ObjectOnSignature} + * @type {ObjectOnSignature} */ this.once; diff --git a/src/ol/Observable.js b/src/ol/Observable.js index 47d3d7b250..e3383ba26e 100644 --- a/src/ol/Observable.js +++ b/src/ol/Observable.js @@ -9,23 +9,24 @@ import {listen, listenOnce, unlistenByKey} from './events.js'; * @template {string} Type * @template {Event|import("./events/Event.js").default} EventClass * @template Return - * @typedef {(type: Type|Type[], listener: (event: EventClass) => ?) => Return} OnSignature + * @typedef {(type: Type, listener: (event: EventClass) => ?) => Return} OnSignature */ /*** * @template {string} Type * @template Return - * @typedef {(type: Type[], listener: (event: Event|import("./events/Event").default) => ?) => Return} CombinedOnSignature - */ - -/*** - * @typedef {import("./events").EventsKey|Array} OnReturn + * @typedef {(type: Type[], listener: (event: Event|import("./events/Event").default) => ?) => Return extends void ? void : Return[]} CombinedOnSignature */ /** * @typedef {'change'|'error'} EventTypes */ +/*** + * @template Return + * @typedef {OnSignature & CombinedOnSignature} ObservableOnSignature + */ + /** * @classdesc * Abstract base class; normally only used for creating subclasses and not @@ -41,20 +42,17 @@ class Observable extends EventTarget { constructor() { super(); - /*** - * @type {OnSignature} - */ - this.on = this.onInternal; + this.on = + /** @type {ObservableOnSignature} */ ( + this.onInternal + ); - /*** - * @type {OnSignature} - */ - this.once = this.onceInternal; + this.once = + /** @type {ObservableOnSignature} */ ( + this.onceInternal + ); - /*** - * @type {OnSignature} - */ - this.un = this.unInternal; + this.un = /** @type {ObservableOnSignature} */ (this.unInternal); /** * @private @@ -84,7 +82,7 @@ class Observable extends EventTarget { /** * @param {string|Array} type Type. - * @param {function(?): ?} listener Listener. + * @param {function((Event|import("./events/Event").default)): ?} listener Listener. * @return {import("./events.js").EventsKey|Array} Event key. * @protected */ @@ -103,7 +101,7 @@ class Observable extends EventTarget { /** * @param {string|Array} type Type. - * @param {function(?): ?} listener Listener. + * @param {function((Event|import("./events/Event").default)): ?} listener Listener. * @return {import("./events.js").EventsKey|Array} Event key. * @protected */ @@ -125,7 +123,7 @@ class Observable extends EventTarget { /** * Unlisten for a certain type of event. * @param {string|Array} type Type. - * @param {function(?): ?} listener Listener. + * @param {function((Event|import("./events/Event").default)): ?} listener Listener. * @protected */ unInternal(type, listener) { diff --git a/src/ol/Overlay.js b/src/ol/Overlay.js index 6391d3c874..cfdc81b205 100644 --- a/src/ol/Overlay.js +++ b/src/ol/Overlay.js @@ -123,12 +123,12 @@ class Overlay extends BaseObject { super(); /*** - * @type {OverlayOnSignature} + * @type {OverlayOnSignature} */ this.on; /*** - * @type {OverlayOnSignature} + * @type {OverlayOnSignature} */ this.once; diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index 85b5443849..037db533d2 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -158,12 +158,12 @@ class PluggableMap extends BaseObject { super(); /*** - * @type {PluggableMapOnSignature} + * @type {PluggableMapOnSignature} */ this.on; /*** - * @type {PluggableMapOnSignature} + * @type {PluggableMapOnSignature} */ this.once; diff --git a/src/ol/View.js b/src/ol/View.js index 9fe4a8c23c..c2a494f460 100644 --- a/src/ol/View.js +++ b/src/ol/View.js @@ -309,12 +309,12 @@ class View extends BaseObject { super(); /*** - * @type {ViewOnSignature} + * @type {ViewOnSignature} */ this.on; /*** - * @type {ViewOnSignature} + * @type {ViewOnSignature} */ this.once; diff --git a/src/ol/control/FullScreen.js b/src/ol/control/FullScreen.js index 50906b4ce7..37e733f463 100644 --- a/src/ol/control/FullScreen.js +++ b/src/ol/control/FullScreen.js @@ -90,12 +90,12 @@ class FullScreen extends Control { }); /*** - * @type {FullScreenOnSignature} + * @type {FullScreenOnSignature} */ this.on; /*** - * @type {FullScreenOnSignature} + * @type {FullScreenOnSignature} */ this.once; diff --git a/src/ol/control/MousePosition.js b/src/ol/control/MousePosition.js index 57ad4eb59b..e95a4b3116 100644 --- a/src/ol/control/MousePosition.js +++ b/src/ol/control/MousePosition.js @@ -80,12 +80,12 @@ class MousePosition extends Control { }); /*** - * @type {MousePositionOnSignature} + * @type {MousePositionOnSignature} */ this.on; /*** - * @type {MousePositionOnSignature} + * @type {MousePositionOnSignature} */ this.once; diff --git a/src/ol/control/ScaleLine.js b/src/ol/control/ScaleLine.js index dc9e09863c..79fc6afccc 100644 --- a/src/ol/control/ScaleLine.js +++ b/src/ol/control/ScaleLine.js @@ -100,12 +100,12 @@ class ScaleLine extends Control { }); /*** - * @type {ScaleLineOnSignature} + * @type {ScaleLineOnSignature} */ this.on; /*** - * @type {ScaleLineOnSignature} + * @type {ScaleLineOnSignature} */ this.once; diff --git a/src/ol/interaction/DragAndDrop.js b/src/ol/interaction/DragAndDrop.js index 565145e8f3..1fb2af12fd 100644 --- a/src/ol/interaction/DragAndDrop.js +++ b/src/ol/interaction/DragAndDrop.js @@ -108,12 +108,12 @@ class DragAndDrop extends Interaction { }); /*** - * @type {DragAndDropOnSignature} + * @type {DragAndDropOnSignature} */ this.on; /*** - * @type {DragAndDropOnSignature} + * @type {DragAndDropOnSignature} */ this.once; diff --git a/src/ol/interaction/DragBox.js b/src/ol/interaction/DragBox.js index a43c7f0912..3a17a1dcbb 100644 --- a/src/ol/interaction/DragBox.js +++ b/src/ol/interaction/DragBox.js @@ -123,12 +123,12 @@ class DragBox extends PointerInteraction { super(); /*** - * @type {DragBoxOnSignature} + * @type {DragBoxOnSignature} */ this.on; /*** - * @type {DragBoxOnSignature} + * @type {DragBoxOnSignature} */ this.once; diff --git a/src/ol/interaction/Draw.js b/src/ol/interaction/Draw.js index 28f655bee0..f01e3e1a9c 100644 --- a/src/ol/interaction/Draw.js +++ b/src/ol/interaction/Draw.js @@ -204,12 +204,12 @@ class Draw extends PointerInteraction { super(pointerOptions); /*** - * @type {DrawOnSignature} + * @type {DrawOnSignature} */ this.on; /*** - * @type {DrawOnSignature} + * @type {DrawOnSignature} */ this.once; diff --git a/src/ol/interaction/Extent.js b/src/ol/interaction/Extent.js index 9ab7ee430f..701082ca5e 100644 --- a/src/ol/interaction/Extent.js +++ b/src/ol/interaction/Extent.js @@ -103,12 +103,12 @@ class Extent extends PointerInteraction { super(/** @type {import("./Pointer.js").Options} */ (options)); /*** - * @type {ExtentOnSignature} + * @type {ExtentOnSignature} */ this.on; /*** - * @type {ExtentOnSignature} + * @type {ExtentOnSignature} */ this.once; diff --git a/src/ol/interaction/Interaction.js b/src/ol/interaction/Interaction.js index ae033f586a..1e59919055 100644 --- a/src/ol/interaction/Interaction.js +++ b/src/ol/interaction/Interaction.js @@ -46,12 +46,12 @@ class Interaction extends BaseObject { super(); /*** - * @type {InteractionOnSignature} + * @type {InteractionOnSignature} */ this.on; /*** - * @type {InteractionOnSignature} + * @type {InteractionOnSignature} */ this.once; diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index 8b0bbe1bcb..383d0217e8 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -203,12 +203,12 @@ class Modify extends PointerInteraction { super(/** @type {import("./Pointer.js").Options} */ (options)); /*** - * @type {ModifyOnSignature} + * @type {ModifyOnSignature} */ this.on; /*** - * @type {ModifyOnSignature} + * @type {ModifyOnSignature} */ this.once; diff --git a/src/ol/interaction/Select.js b/src/ol/interaction/Select.js index f1f67baa4a..ffebf49933 100644 --- a/src/ol/interaction/Select.js +++ b/src/ol/interaction/Select.js @@ -167,12 +167,12 @@ class Select extends Interaction { super(); /*** - * @type {SelectOnSignature} + * @type {SelectOnSignature} */ this.on; /*** - * @type {SelectOnSignature} + * @type {SelectOnSignature} */ this.once; diff --git a/src/ol/interaction/Translate.js b/src/ol/interaction/Translate.js index c2b7efe110..b5d54cd61e 100644 --- a/src/ol/interaction/Translate.js +++ b/src/ol/interaction/Translate.js @@ -140,12 +140,12 @@ class Translate extends PointerInteraction { super(/** @type {import("./Pointer.js").Options} */ (options)); /*** - * @type {TranslateOnSignature} + * @type {TranslateOnSignature} */ this.on; /*** - * @type {TranslateOnSignature} + * @type {TranslateOnSignature} */ this.once; diff --git a/src/ol/layer/Base.js b/src/ol/layer/Base.js index c4671dfca2..4a06cb4051 100644 --- a/src/ol/layer/Base.js +++ b/src/ol/layer/Base.js @@ -60,12 +60,12 @@ class BaseLayer extends BaseObject { super(); /*** - * @type {BaseLayerOnSignature} + * @type {BaseLayerOnSignature} */ this.on; /*** - * @type {BaseLayerOnSignature} + * @type {BaseLayerOnSignature} */ this.once; diff --git a/src/ol/layer/BaseTile.js b/src/ol/layer/BaseTile.js index 5fd7d8cd9d..d77c816769 100644 --- a/src/ol/layer/BaseTile.js +++ b/src/ol/layer/BaseTile.js @@ -72,12 +72,12 @@ class BaseTileLayer extends Layer { super(baseOptions); /*** - * @type {BaseTileLayerOnSignature} + * @type {BaseTileLayerOnSignature} */ this.on; /*** - * @type {BaseTileLayerOnSignature} + * @type {BaseTileLayerOnSignature} */ this.once; diff --git a/src/ol/layer/Group.js b/src/ol/layer/Group.js index 804cb8f68a..7bdc2674f0 100644 --- a/src/ol/layer/Group.js +++ b/src/ol/layer/Group.js @@ -73,12 +73,12 @@ class LayerGroup extends BaseLayer { super(baseOptions); /*** - * @type {GroupOnSignature} + * @type {GroupOnSignature} */ this.on; /*** - * @type {GroupOnSignature} + * @type {GroupOnSignature} */ this.once; diff --git a/src/ol/layer/Layer.js b/src/ol/layer/Layer.js index 57aafb521c..d0abe30454 100644 --- a/src/ol/layer/Layer.js +++ b/src/ol/layer/Layer.js @@ -107,12 +107,12 @@ class Layer extends BaseLayer { super(baseOptions); /*** - * @type {LayerOnSignature} + * @type {LayerOnSignature} */ this.on; /*** - * @type {LayerOnSignature} + * @type {LayerOnSignature} */ this.once; diff --git a/src/ol/layer/VectorTile.js b/src/ol/layer/VectorTile.js index 9921a3ccc5..a12695a1b3 100644 --- a/src/ol/layer/VectorTile.js +++ b/src/ol/layer/VectorTile.js @@ -106,12 +106,12 @@ class VectorTileLayer extends BaseVectorLayer { ); /*** - * @type {VectorTileLayerOnSignature} + * @type {VectorTileLayerOnSignature} */ this.on; /*** - * @type {VectorTileLayerOnSignature} + * @type {VectorTileLayerOnSignature} */ this.once; diff --git a/src/ol/source/Image.js b/src/ol/source/Image.js index f2df3fef46..9112078ad8 100644 --- a/src/ol/source/Image.js +++ b/src/ol/source/Image.js @@ -103,12 +103,12 @@ class ImageSource extends Source { }); /*** - * @type {ImageSourceOnSignature} + * @type {ImageSourceOnSignature} */ this.on; /*** - * @type {ImageSourceOnSignature} + * @type {ImageSourceOnSignature} */ this.once; diff --git a/src/ol/source/Raster.js b/src/ol/source/Raster.js index 3528ea3b51..824c0e62c8 100644 --- a/src/ol/source/Raster.js +++ b/src/ol/source/Raster.js @@ -548,12 +548,12 @@ class RasterSource extends ImageSource { }); /*** - * @type {RasterSourceOnSignature} + * @type {RasterSourceOnSignature} */ this.on; /*** - * @type {RasterSourceOnSignature} + * @type {RasterSourceOnSignature} */ this.once; diff --git a/src/ol/source/Tile.js b/src/ol/source/Tile.js index ca21e646a1..423848cbd4 100644 --- a/src/ol/source/Tile.js +++ b/src/ol/source/Tile.js @@ -62,12 +62,12 @@ class TileSource extends Source { }); /*** - * @type {TileSourceOnSignature} + * @type {TileSourceOnSignature} */ this.on; /*** - * @type {TileSourceOnSignature} + * @type {TileSourceOnSignature} */ this.once; diff --git a/src/ol/source/Vector.js b/src/ol/source/Vector.js index 96440394a7..2ef5c3e0cb 100644 --- a/src/ol/source/Vector.js +++ b/src/ol/source/Vector.js @@ -187,12 +187,12 @@ class VectorSource extends Source { }); /*** - * @type {VectorSourceOnSignature} + * @type {VectorSourceOnSignature} */ this.on; /*** - * @type {VectorSourceOnSignature} + * @type {VectorSourceOnSignature} */ this.once;