From 7701ab932b40511f6406899e89c1b282ee164854 Mon Sep 17 00:00:00 2001 From: Simon Seyock Date: Tue, 22 Jun 2021 16:22:38 +0200 Subject: [PATCH] Add auxiliary type for the `on` signatures. --- src/ol/Observable.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ol/Observable.js b/src/ol/Observable.js index 5962fd5dc7..ec33aee501 100644 --- a/src/ol/Observable.js +++ b/src/ol/Observable.js @@ -5,6 +5,13 @@ import EventTarget from './events/Target.js'; import EventType from './events/EventType.js'; import {listen, listenOnce, unlistenByKey} from './events.js'; + +/*** + * @template {string} Type + * @template {Event|import("./events/Event.js").default} EventClass + * @typedef {(type: Type|Type[], listener: (event: EventClass) => (void|boolean)) => import("./events.js").EventsKey|Array} OnSignature + */ + /** * @classdesc * Abstract base class; normally only used for creating subclasses and not @@ -53,7 +60,7 @@ class Observable extends EventTarget { * @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 + * @protected */ on(type, listener) { if (Array.isArray(type)) {