Use generics to limit event types in on(), once() and un()

This commit is contained in:
Andreas Hocevar
2021-06-20 20:22:53 +02:00
parent cf7213c5cb
commit 018ad97f25
30 changed files with 49 additions and 7 deletions
+2
View File
@@ -41,6 +41,8 @@ import {removeNode} from '../dom.js';
* You can also extend this base for your own control class. See
* examples/custom-controls for an example of how to do this.
*
* @template {string} EventTypes
* @extends BaseObject<EventTypes>
* @api
*/
class Control extends BaseObject {
+1
View File
@@ -66,6 +66,7 @@ const FullScreenEventType = {
*
* @fires FullScreenEventType#enterfullscreen
* @fires FullScreenEventType#leavefullscreen
* @extends Control<'enterfullscreen'|'leavefullscreen'>
* @api
*/
class FullScreen extends Control {
+1
View File
@@ -50,6 +50,7 @@ const COORDINATE_FORMAT = 'coordinateFormat';
* On touch devices, which usually do not have a mouse cursor, the coordinates
* of the currently touched position are shown.
*
* @extends Control<'change:coordinaetFormat'|'change:projection'>
* @api
*/
class MousePosition extends Control {
+1
View File
@@ -69,6 +69,7 @@ const DEFAULT_DPI = 25.4 / 0.28;
* When specifying `bar` as `true`, a scalebar will be rendered instead
* of a scaleline.
*
* @extends Control<'change:units'>
* @api
*/
class ScaleLine extends Control {