Add on signatures for BaseObject and Observable.
This commit is contained in:
committed by
Andreas Hocevar
parent
7701ab932b
commit
baf9ee6a93
@@ -87,6 +87,12 @@ class BaseObject extends Observable {
|
|||||||
constructor(opt_values) {
|
constructor(opt_values) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @type {import("./Observable").OnSignature<import("./Observable").EventTypes, import("./events/Event.js").default> &
|
||||||
|
* import("./Observable").OnSignature<import("./ObjectEventType").Types, ObjectEvent>}
|
||||||
|
*/
|
||||||
|
this.on;
|
||||||
|
|
||||||
// Call {@link module:ol/util.getUid} to ensure that the order of objects' ids is
|
// 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
|
// 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
|
// ensure that object properties are always added in the same order, which
|
||||||
|
|||||||
@@ -13,3 +13,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
PROPERTYCHANGE: 'propertychange',
|
PROPERTYCHANGE: 'propertychange',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {'propertychange'} Types
|
||||||
|
*/
|
||||||
|
|||||||
@@ -5,13 +5,16 @@ import EventTarget from './events/Target.js';
|
|||||||
import EventType from './events/EventType.js';
|
import EventType from './events/EventType.js';
|
||||||
import {listen, listenOnce, unlistenByKey} from './events.js';
|
import {listen, listenOnce, unlistenByKey} from './events.js';
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* @template {string} Type
|
* @template {string} Type
|
||||||
* @template {Event|import("./events/Event.js").default} EventClass
|
* @template {Event|import("./events/Event.js").default} EventClass
|
||||||
* @typedef {(type: Type|Type[], listener: (event: EventClass) => (void|boolean)) => import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} OnSignature
|
* @typedef {(type: Type|Type[], listener: (event: EventClass) => (void|boolean)) => import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} OnSignature
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {'change'|'error'} EventTypes
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* Abstract base class; normally only used for creating subclasses and not
|
* Abstract base class; normally only used for creating subclasses and not
|
||||||
@@ -60,7 +63,7 @@ class Observable extends EventTarget {
|
|||||||
* @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Unique key for the listener. If
|
* @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Unique key for the listener. If
|
||||||
* called with an array of event types as the first argument, the return
|
* called with an array of event types as the first argument, the return
|
||||||
* will be an array of keys.
|
* will be an array of keys.
|
||||||
* @protected
|
* @api
|
||||||
*/
|
*/
|
||||||
on(type, listener) {
|
on(type, listener) {
|
||||||
if (Array.isArray(type)) {
|
if (Array.isArray(type)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user