Transformed types
Using the [ts.js codemod](https://gist.github.com/tschaub/1ea498c9d1e5268cf36d212b3949be4e): jscodeshift --transform ts.js src
This commit is contained in:
@@ -61,7 +61,7 @@ class Event {
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event|module:ol/events/Event} evt Event
|
||||
* @param {Event|import("./Event.js").default} evt Event
|
||||
*/
|
||||
export function stopPropagation(evt) {
|
||||
evt.stopPropagation();
|
||||
@@ -69,7 +69,7 @@ export function stopPropagation(evt) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event|module:ol/events/Event} evt Event
|
||||
* @param {Event|import("./Event.js").default} evt Event
|
||||
*/
|
||||
export function preventDefault(evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
@@ -8,7 +8,7 @@ import Event from '../events/Event.js';
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {EventTarget|module:ol/events/Target} EventTargetLike
|
||||
* @typedef {EventTarget|import("./Target.js").default} EventTargetLike
|
||||
*/
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class Target extends Disposable {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!Object<string, Array<module:ol/events~ListenerFunction>>}
|
||||
* @type {!Object<string, Array<import("../events.js").ListenerFunction>>}
|
||||
*/
|
||||
this.listeners_ = {};
|
||||
|
||||
@@ -54,7 +54,7 @@ class Target extends Disposable {
|
||||
|
||||
/**
|
||||
* @param {string} type Type.
|
||||
* @param {module:ol/events~ListenerFunction} listener Listener.
|
||||
* @param {import("../events.js").ListenerFunction} listener Listener.
|
||||
*/
|
||||
addEventListener(type, listener) {
|
||||
let listeners = this.listeners_[type];
|
||||
@@ -72,8 +72,8 @@ class Target extends Disposable {
|
||||
* Object with a `type` property.
|
||||
*
|
||||
* @param {{type: string,
|
||||
* target: (module:ol/events/Target~EventTargetLike|undefined)}|
|
||||
* module:ol/events/Event|string} event Event object.
|
||||
* target: (EventTargetLike|undefined)}|
|
||||
* import("./Event.js").default|string} event Event object.
|
||||
* @return {boolean|undefined} `false` if anyone called preventDefault on the
|
||||
* event object or if any of the listeners returned false.
|
||||
* @function
|
||||
@@ -122,7 +122,7 @@ class Target extends Disposable {
|
||||
* order that they will be called in.
|
||||
*
|
||||
* @param {string} type Type.
|
||||
* @return {Array<module:ol/events~ListenerFunction>} Listeners.
|
||||
* @return {Array<import("../events.js").ListenerFunction>} Listeners.
|
||||
*/
|
||||
getListeners(type) {
|
||||
return this.listeners_[type];
|
||||
@@ -141,7 +141,7 @@ class Target extends Disposable {
|
||||
|
||||
/**
|
||||
* @param {string} type Type.
|
||||
* @param {module:ol/events~ListenerFunction} listener Listener.
|
||||
* @param {import("../events.js").ListenerFunction} listener Listener.
|
||||
*/
|
||||
removeEventListener(type, listener) {
|
||||
const listeners = this.listeners_[type];
|
||||
|
||||
+18
-18
@@ -11,7 +11,7 @@ import {WEBKIT, MAC} from '../has.js';
|
||||
* A function that takes an {@link module:ol/MapBrowserEvent} and returns a
|
||||
* `{boolean}`. If the condition is met, true should be returned.
|
||||
*
|
||||
* @typedef {function(this: ?, module:ol/MapBrowserEvent): boolean} Condition
|
||||
* @typedef {function(this: ?, import("../MapBrowserEvent.js").default): boolean} Condition
|
||||
*/
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import {WEBKIT, MAC} from '../has.js';
|
||||
* Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when
|
||||
* additionally the shift-key is pressed).
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True if only the alt key is pressed.
|
||||
* @api
|
||||
*/
|
||||
@@ -36,7 +36,7 @@ export const altKeyOnly = function(mapBrowserEvent) {
|
||||
* Return `true` if only the alt-key and shift-key is pressed, `false` otherwise
|
||||
* (e.g. when additionally the platform-modifier-key is pressed).
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True if only the alt and shift keys are pressed.
|
||||
* @api
|
||||
*/
|
||||
@@ -53,7 +53,7 @@ export const altShiftKeysOnly = function(mapBrowserEvent) {
|
||||
* Return `true` if the map has the focus. This condition requires a map target
|
||||
* element with a `tabindex` attribute, e.g. `<div id="map" tabindex="1">`.
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} event Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} event Map browser event.
|
||||
* @return {boolean} The map has the focus.
|
||||
* @api
|
||||
*/
|
||||
@@ -65,7 +65,7 @@ export const focus = function(event) {
|
||||
/**
|
||||
* Return always true.
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True.
|
||||
* @function
|
||||
* @api
|
||||
@@ -76,7 +76,7 @@ export const always = TRUE;
|
||||
/**
|
||||
* Return `true` if the event is a `click` event, `false` otherwise.
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True if the event is a map `click` event.
|
||||
* @api
|
||||
*/
|
||||
@@ -91,7 +91,7 @@ export const click = function(mapBrowserEvent) {
|
||||
* By definition, this includes left-click on windows/linux, and left-click
|
||||
* without the ctrl key on Macs.
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} The result.
|
||||
*/
|
||||
export const mouseActionButton = function(mapBrowserEvent) {
|
||||
@@ -104,7 +104,7 @@ export const mouseActionButton = function(mapBrowserEvent) {
|
||||
/**
|
||||
* Return always false.
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} False.
|
||||
* @function
|
||||
* @api
|
||||
@@ -116,7 +116,7 @@ export const never = FALSE;
|
||||
* Return `true` if the browser event is a `pointermove` event, `false`
|
||||
* otherwise.
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True if the browser event is a `pointermove` event.
|
||||
* @api
|
||||
*/
|
||||
@@ -128,7 +128,7 @@ export const pointerMove = function(mapBrowserEvent) {
|
||||
/**
|
||||
* Return `true` if the event is a map `singleclick` event, `false` otherwise.
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True if the event is a map `singleclick` event.
|
||||
* @api
|
||||
*/
|
||||
@@ -140,7 +140,7 @@ export const singleClick = function(mapBrowserEvent) {
|
||||
/**
|
||||
* Return `true` if the event is a map `dblclick` event, `false` otherwise.
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True if the event is a map `dblclick` event.
|
||||
* @api
|
||||
*/
|
||||
@@ -153,7 +153,7 @@ export const doubleClick = function(mapBrowserEvent) {
|
||||
* Return `true` if no modifier key (alt-, shift- or platform-modifier-key) is
|
||||
* pressed.
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True only if there no modifier keys are pressed.
|
||||
* @api
|
||||
*/
|
||||
@@ -171,7 +171,7 @@ export const noModifierKeys = function(mapBrowserEvent) {
|
||||
* ctrl-key otherwise) is pressed, `false` otherwise (e.g. when additionally
|
||||
* the shift-key is pressed).
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True if only the platform modifier key is pressed.
|
||||
* @api
|
||||
*/
|
||||
@@ -187,7 +187,7 @@ export const platformModifierKeyOnly = function(mapBrowserEvent) {
|
||||
* Return `true` if only the shift-key is pressed, `false` otherwise (e.g. when
|
||||
* additionally the alt-key is pressed).
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True if only the shift key is pressed.
|
||||
* @api
|
||||
*/
|
||||
@@ -204,7 +204,7 @@ export const shiftKeyOnly = function(mapBrowserEvent) {
|
||||
* Return `true` if the target element is not editable, i.e. not a `<input>`-,
|
||||
* `<select>`- or `<textarea>`-element, `false` otherwise.
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True only if the target element is not editable.
|
||||
* @api
|
||||
*/
|
||||
@@ -221,7 +221,7 @@ export const targetNotEditable = function(mapBrowserEvent) {
|
||||
/**
|
||||
* Return `true` if the event originates from a mouse device.
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True if the event originates from a mouse device.
|
||||
* @api
|
||||
*/
|
||||
@@ -229,7 +229,7 @@ export const mouseOnly = function(mapBrowserEvent) {
|
||||
assert(mapBrowserEvent.pointerEvent, 56); // mapBrowserEvent must originate from a pointer event
|
||||
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
|
||||
return (
|
||||
/** @type {module:ol/MapBrowserEvent} */ (mapBrowserEvent).pointerEvent.pointerType == 'mouse'
|
||||
/** @type {import("../MapBrowserEvent.js").default} */ (mapBrowserEvent).pointerEvent.pointerType == 'mouse'
|
||||
);
|
||||
};
|
||||
|
||||
@@ -239,7 +239,7 @@ export const mouseOnly = function(mapBrowserEvent) {
|
||||
* contact with the surface or if the left mouse button is pressed.
|
||||
* See http://www.w3.org/TR/pointerevents/#button-states.
|
||||
*
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True if the event originates from a primary pointer.
|
||||
* @api
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user