From 167bc1ec786a6d679c2d00fd95da7466661ce7f2 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 8 May 2018 08:38:34 -0600 Subject: [PATCH] Remove externs/oli.js --- config/jsdoc/api/conf.json | 3 +- config/jsdoc/api/plugins/api.js | 6 +- config/jsdoc/api/readme.md | 15 -- doc/tutorials/closure.md | 6 - doc/tutorials/custom-builds.md | 2 - externs/oli.js | 385 ------------------------------ externs/readme.md | 83 +------ src/ol/AssertionError.js | 1 - src/ol/Collection.js | 1 - src/ol/MapBrowserEvent.js | 1 - src/ol/MapEvent.js | 1 - src/ol/Object.js | 1 - src/ol/control/Control.js | 1 - src/ol/events/Event.js | 1 - src/ol/interaction/DragAndDrop.js | 1 - src/ol/interaction/DragBox.js | 1 - src/ol/interaction/Draw.js | 1 - src/ol/interaction/Extent.js | 1 - src/ol/interaction/Modify.js | 1 - src/ol/interaction/Select.js | 1 - src/ol/interaction/Translate.js | 1 - src/ol/render/Event.js | 1 - src/ol/source/Image.js | 1 - src/ol/source/Raster.js | 1 - src/ol/source/Tile.js | 1 - src/ol/source/Vector.js | 1 - 26 files changed, 4 insertions(+), 515 deletions(-) delete mode 100644 externs/oli.js diff --git a/config/jsdoc/api/conf.json b/config/jsdoc/api/conf.json index 7b44b8f119..0a0cfb601f 100644 --- a/config/jsdoc/api/conf.json +++ b/config/jsdoc/api/conf.json @@ -10,8 +10,7 @@ "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_", "include": [ - "src", - "externs/oli.js" + "src" ] }, "plugins": [ diff --git a/config/jsdoc/api/plugins/api.js b/config/jsdoc/api/plugins/api.js index fbb26b0a37..4f2204a21f 100644 --- a/config/jsdoc/api/plugins/api.js +++ b/config/jsdoc/api/plugins/api.js @@ -57,10 +57,8 @@ function includeAugments(doclet) { } }); } - if (cls.longname.indexOf('oli.') !== 0) { - cls._hideConstructor = true; - delete cls.undocumented; - } + cls._hideConstructor = true; + delete cls.undocumented; } } } diff --git a/config/jsdoc/api/readme.md b/config/jsdoc/api/readme.md index d4df450558..db290d473d 100644 --- a/config/jsdoc/api/readme.md +++ b/config/jsdoc/api/readme.md @@ -47,21 +47,6 @@ ol.MapBrowserEventType = { ``` Note the value of the `@event` annotation. The text before the hash refers to the event class that the event belongs to, and the text after the hash is the type of the event. -To export event properties, they need to be defined in `externs/oli.js` (also see `readme.md` in `externs/`) and marked with an @api annotation: -```js -/** @interface */ -oli.MapBrowserEvent; - -/** - * @type {ol.Coordinate} - * @api - */ -oli.MapBrowserEvent.prototype.coordinate; - -// ... - -}; -``` To document which events are fired by a class or method, the `@fires` annotation is used: ```js /** diff --git a/doc/tutorials/closure.md b/doc/tutorials/closure.md index 500c6e2ccc..ec0fc7db87 100644 --- a/doc/tutorials/closure.md +++ b/doc/tutorials/closure.md @@ -175,9 +175,6 @@ The minimum config file looks like this: "define": [ "ol.ENABLE_WEBGL=false" ], - "js": [ - "node_modules/openlayers/externs/oli.js" - ], "extra_annotation_name": [ "api", "observable" ], @@ -225,9 +222,6 @@ Here is a version of `config.json` with more compilation checks enabled: "define": [ "ol.ENABLE_WEBGL=false" ], - "js": [ - "node_modules/openlayers/externs/oli.js" - ], "jscomp_error": [ "*" ], diff --git a/doc/tutorials/custom-builds.md b/doc/tutorials/custom-builds.md index adc3195811..e1a2ee3986 100644 --- a/doc/tutorials/custom-builds.md +++ b/doc/tutorials/custom-builds.md @@ -55,7 +55,6 @@ Creating a custom build requires writing a build configuration file. The format "externs/closure-compiler.js", "externs/esrijson.js", "externs/geojson.js", - "externs/oli.js", "externs/proj4js.js", "externs/tilejson.js", "externs/topojson.js" @@ -205,7 +204,6 @@ Now let's try a more complicated example: [`heatmaps-earthquakes`](https://openl "externs/closure-compiler.js", "externs/esrijson.js", "externs/geojson.js", - "externs/oli.js", "externs/proj4js.js", "externs/tilejson.js", "externs/topojson.js" diff --git a/externs/oli.js b/externs/oli.js deleted file mode 100644 index 5ff51a5262..0000000000 --- a/externs/oli.js +++ /dev/null @@ -1,385 +0,0 @@ -/** - * @externs - */ - - -/** - * @type {Object} - */ -let oli; - - -/** - * @interface - */ -oli.AssertionError = function() {}; - - -/** - * @type {number} - */ -oli.AssertionError.prototype.code; - - -/** - * @interface - */ -oli.events.Event = function() {}; - - -/** - * @type {Object} - */ -oli.events.Event.prototype.target; - - -/** - * @type {string} - */ -oli.events.Event.prototype.type; - - -/** - */ -oli.events.Event.prototype.preventDefault = function() {}; - - -/** - */ -oli.events.Event.prototype.stopPropagation = function() {}; - - -/** - * @interface - */ -oli.Collection.Event = function() {}; - - -/** - * @type {*} - */ -oli.Collection.Event.prototype.element; - - -/** - * @interface - */ -oli.DragBoxEvent = function() {}; - - -/** - * @type {ol.Coordinate} - */ -oli.DragBoxEvent.prototype.coordinate; - - -/** - * @type {module:ol/MapBrowserEvent~MapBrowserEvent} - */ -oli.DragBoxEvent.prototype.mapBrowserEvent; - - -/** - * @interface - */ -oli.DrawEvent = function() {}; - - -/** - * @type {module:ol/Feature~Feature} - */ -oli.DrawEvent.prototype.feature; - - -/** - * @interface - */ -oli.ExtentEvent = function() {}; - - -/** - * @type {ol.Extent} - */ -oli.ExtentEvent.prototype.extent; - -/** - * @interface - */ -oli.ModifyEvent = function() {}; - - -/** - * @type {ol.Collection.} - */ -oli.ModifyEvent.prototype.features; - - -/** - * @type {module:ol/MapBrowserEvent~MapBrowserEvent} - */ -oli.ModifyEvent.prototype.mapBrowserEvent; - - -/** - * @type {Object} - */ -oli.Object; - - -/** - * @interface - */ -oli.Object.Event = function() {}; - - -/** - * @type {string} - */ -oli.Object.Event.prototype.key; - - -/** - * @type {*} - */ -oli.Object.Event.prototype.oldValue; - - -/** - * @interface - */ -oli.MapBrowserEvent = function() {}; - - -/** - * @type {ol.Coordinate} - */ -oli.MapBrowserEvent.prototype.coordinate; - - -/** - * @type {Event} - */ -oli.MapBrowserEvent.prototype.originalEvent; - - -/** - * @type {ol.Pixel} - */ -oli.MapBrowserEvent.prototype.pixel; - - -/** - * @type {boolean} - */ -oli.MapBrowserEvent.prototype.dragging; - - -/** - * @interface - */ -oli.MapEvent = function() {}; - - -/** - * @type {ol.PluggableMap} - */ -oli.MapEvent.prototype.map; - - -/** - * @type {module:ol/PluggableMap~FrameState} - */ -oli.MapEvent.prototype.frameState; - - -/** - * @interface - */ -oli.SelectEvent = function() {}; - - -/** - * @type {Array.} - */ -oli.SelectEvent.prototype.deselected; - - -/** - * @type {Array.} - */ -oli.SelectEvent.prototype.selected; - - -/** - * @type {module:ol/MapBrowserEvent~MapBrowserEvent} - */ -oli.SelectEvent.prototype.mapBrowserEvent; - - -/** - * @type {Object} - */ -oli.control; - - -/** - * @interface - */ -oli.control.Control = function() {}; - - -/** - * @param {ol.PluggableMap} map Map. - * @return {undefined} Undefined. - */ -oli.control.Control.prototype.setMap = function(map) {}; - - -/** - * @type {Object} - */ -oli.interaction; - - -/** - * @interface - */ -oli.interaction.DragAndDropEvent = function() {}; - - -/** - * @type {Array.|undefined} - */ -oli.interaction.DragAndDropEvent.prototype.features; - - -/** - * @type {module:ol/proj/Projection~Projection|undefined} - */ -oli.interaction.DragAndDropEvent.prototype.projection; - - -/** - * @type {File} - */ -oli.interaction.DragAndDropEvent.prototype.file; - - -/** - * @interface - */ -oli.interaction.TranslateEvent = function() {}; - - -/** - * @type {ol.Collection.} - */ -oli.interaction.TranslateEvent.prototype.features; - - -/** - * @type {ol.Coordinate} - */ -oli.interaction.TranslateEvent.prototype.coordinate; - - -/** - * @type {Object} - */ -oli.render; - - -/** - * @interface - */ -oli.render.Event = function() {}; - - -/** - * @type {CanvasRenderingContext2D|null|undefined} - */ -oli.render.Event.prototype.context; - - -/** - * @type {module:ol/PluggableMap~FrameState|undefined} - */ -oli.render.Event.prototype.frameState; - - -/** - * @type {ol.webgl.Context|null|undefined} - */ -oli.render.Event.prototype.glContext; - - -/** - * @type {ol.render.VectorContext|undefined} - */ -oli.render.Event.prototype.vectorContext; - - -/** - * @type {Object} - */ -oli.source; - - -/** - * @interface - */ -oli.source.ImageEvent = function() {}; - - -/** - * @type {ol.Image} - */ -oli.source.ImageEvent.prototype.image; - - -/** - * @interface - */ -oli.source.RasterEvent = function() {}; - - -/** - * @type {ol.Extent} - */ -oli.source.RasterEvent.prototype.extent; - - -/** - * @type {number} - */ -oli.source.RasterEvent.prototype.resolution; - - -/** - * @type {Object} - */ -oli.source.RasterEvent.prototype.data; - - -/** - * @interface - */ -oli.source.Tile.Event = function() {}; - - -/** - * @type {ol.Tile} - */ -oli.source.Tile.Event.prototype.tile; - - -/** - * @interface - */ -oli.source.Vector.Event = function() {}; - - -/** - * @type {module:ol/Feature~Feature|undefined} - */ -oli.source.Vector.Event.prototype.feature; diff --git a/externs/readme.md b/externs/readme.md index 579c782c98..3856ac5b44 100644 --- a/externs/readme.md +++ b/externs/readme.md @@ -1,84 +1,3 @@ # Externs -This directory contains externs files, which tell the Closure compiler about symbols and properties that it should not rename. - -## oli.js - -These are special externs that belong to OpenLayers, and this document explains their purpose and how they are used. - -### Prevent class properties from being renamed - -For events, we make properties available to the application. Methods can be made available by just marking them with the `@api` annotation directly where they are defined; properties should also be added to `oli.js`: - -```js -/** - * @interface - */ -oli.MapBrowserEvent = function() {}; - -/** - * @type {ol.Coordinate} - */ -oli.MapBrowserEvent.prototype.coordinate; -``` -In the source file (`src/ol/MapBrowserEvent.js`), the class needs to implement this interface: -```js -/** - * ... - * @constructor - * @implements {oli.MapBrowserEvent} - */ -ol.MapBrowserEvent = function(type, map, originalEvent, opt_frameState) { - - // ... - - /** - * @type {ol.Coordinate} - * @api - */ - this.coordinate = map.getEventCoordinate(this.originalEvent); - - // ... - -}; -``` - -### Override methods in custom classes - -For custom subclasses in applications, which can be created using `ol.inherits`, the API may want to make certain methods available to override. In addition to marking such methods as `@api`, they should also be added to an interface in `oli.js`: -```js -/** - * @interface - */ -oli.control.Control = function() {}; - -/** - * @param {ol.PluggableMap} map Map. - * @return {undefined} Undefined. - */ -oli.control.Control.prototype.setMap = function(map) {}; - -``` -This interface must be implemented by the class in the source file (`src/ol/control/control.js`): -```js -/** - * ... - * @constructor - * @implements {oli.control.Control} - */ -ol.control.Control = function(options) { - // ... -}; - -// ... - -/** - * Application subclasses may override this. - * @param {ol.PluggableMap} map Map. - * @api - */ -ol.control.Control.prototype.setMap = function(map) { - // ... -}; -``` -See Custom controls example for an example of how this can be used. +TODO: remove this directory diff --git a/src/ol/AssertionError.js b/src/ol/AssertionError.js index 1f8b3704fd..ba70e8a492 100644 --- a/src/ol/AssertionError.js +++ b/src/ol/AssertionError.js @@ -9,7 +9,6 @@ import {VERSION, inherits} from './index.js'; * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error} * @constructor * @extends {Error} - * @implements {oli.AssertionError} * @param {number} code Error code. */ const AssertionError = function(code) { diff --git a/src/ol/Collection.js b/src/ol/Collection.js index 9c1e9c8937..bca2a49ba8 100644 --- a/src/ol/Collection.js +++ b/src/ol/Collection.js @@ -24,7 +24,6 @@ const Property = { * * @constructor * @extends {module:ol/events/Event} - * @implements {oli.CollectionEvent} * @param {module:ol/CollectionEventType} type Type. * @param {*=} opt_element Element. */ diff --git a/src/ol/MapBrowserEvent.js b/src/ol/MapBrowserEvent.js index a17fd9b3da..fdecce32ba 100644 --- a/src/ol/MapBrowserEvent.js +++ b/src/ol/MapBrowserEvent.js @@ -11,7 +11,6 @@ import MapEvent from './MapEvent.js'; * * @constructor * @extends {module:ol/MapEvent} - * @implements {oli.MapBrowserEvent} * @param {string} type Event type. * @param {module:ol/PluggableMap} map Map. * @param {Event} browserEvent Browser event. diff --git a/src/ol/MapEvent.js b/src/ol/MapEvent.js index 200b634802..4ef008325c 100644 --- a/src/ol/MapEvent.js +++ b/src/ol/MapEvent.js @@ -11,7 +11,6 @@ import Event from './events/Event.js'; * * @constructor * @extends {module:ol/events/Event} - * @implements {oli.MapEvent} * @param {string} type Event type. * @param {module:ol/PluggableMap} map Map. * @param {?module:ol/PluggableMap~FrameState=} opt_frameState Frame state. diff --git a/src/ol/Object.js b/src/ol/Object.js index 431d8d4983..936b142342 100644 --- a/src/ol/Object.js +++ b/src/ol/Object.js @@ -17,7 +17,6 @@ import {assign} from './obj.js'; * @param {string} key The property name. * @param {*} oldValue The old value for `key`. * @extends {module:ol/events/Event} - * @implements {oli.Object.Event} * @constructor */ const ObjectEvent = function(type, key, oldValue) { diff --git a/src/ol/control/Control.js b/src/ol/control/Control.js index 0d4989866d..7da5875aec 100644 --- a/src/ol/control/Control.js +++ b/src/ol/control/Control.js @@ -46,7 +46,6 @@ import {listen, unlistenByKey} from '../events.js'; * * @constructor * @extends {module:ol/Object} - * @implements {oli.control.Control} * @param {module:ol/control/Control~Options} options Control options. * @api */ diff --git a/src/ol/events/Event.js b/src/ol/events/Event.js index 159f8beed0..b1f24b3830 100644 --- a/src/ol/events/Event.js +++ b/src/ol/events/Event.js @@ -12,7 +12,6 @@ * {@link module:ol/events/EventTarget~EventTarget}. * * @constructor - * @implements {oli.events.Event} * @param {string} type Type. */ const Event = function(type) { diff --git a/src/ol/interaction/DragAndDrop.js b/src/ol/interaction/DragAndDrop.js index da5b56a6cc..4656a5b24c 100644 --- a/src/ol/interaction/DragAndDrop.js +++ b/src/ol/interaction/DragAndDrop.js @@ -45,7 +45,6 @@ const DragAndDropEventType = { * * @constructor * @extends {module:ol/events/Event} - * @implements {oli.interaction.DragAndDropEvent} * @param {module:ol/interaction/DragAndDrop~DragAndDropEventType} type Type. * @param {File} file File. * @param {Array.=} opt_features Features. diff --git a/src/ol/interaction/DragBox.js b/src/ol/interaction/DragBox.js index bb23bb0499..b99939024c 100644 --- a/src/ol/interaction/DragBox.js +++ b/src/ol/interaction/DragBox.js @@ -69,7 +69,6 @@ const DragBoxEventType = { * @param {module:ol/MapBrowserEvent} mapBrowserEvent Originating event. * @extends {module:ol/events/Event} * @constructor - * @implements {oli.DragBoxEvent} */ const DragBoxEvent = function(type, coordinate, mapBrowserEvent) { Event.call(this, type); diff --git a/src/ol/interaction/Draw.js b/src/ol/interaction/Draw.js index c10e1b0ca2..01a1c4ade9 100644 --- a/src/ol/interaction/Draw.js +++ b/src/ol/interaction/Draw.js @@ -131,7 +131,6 @@ const DrawEventType = { * * @constructor * @extends {module:ol/events/Event} - * @implements {oli.DrawEvent} * @param {module:ol/interaction/Draw~DrawEventType} type Type. * @param {module:ol/Feature} feature The feature drawn. */ diff --git a/src/ol/interaction/Extent.js b/src/ol/interaction/Extent.js index 0d4415bdc1..9abb63b1b5 100644 --- a/src/ol/interaction/Extent.js +++ b/src/ol/interaction/Extent.js @@ -53,7 +53,6 @@ const ExtentEventType = { * instances of this type. * * @constructor - * @implements {oli.ExtentEvent} * @param {module:ol/extent~Extent} extent the new extent * @extends {module:ol/events/Event} */ diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index 6ae14aa33f..642fdf7423 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -93,7 +93,6 @@ const ModifyEventType = { * * @constructor * @extends {module:ol/events/Event} - * @implements {oli.ModifyEvent} * @param {ModifyEventType} type Type. * @param {module:ol/Collection.} features * The features modified. diff --git a/src/ol/interaction/Select.js b/src/ol/interaction/Select.js index 5856157184..1c02c7e25b 100644 --- a/src/ol/interaction/Select.js +++ b/src/ol/interaction/Select.js @@ -107,7 +107,6 @@ const SelectEventType = { * @param {Array.} deselected Deselected features. * @param {module:ol/MapBrowserEvent} mapBrowserEvent Associated * {@link module:ol/MapBrowserEvent}. - * @implements {oli.SelectEvent} * @extends {module:ol/events/Event} * @constructor */ diff --git a/src/ol/interaction/Translate.js b/src/ol/interaction/Translate.js index ddf76b4cd3..0504bc590b 100644 --- a/src/ol/interaction/Translate.js +++ b/src/ol/interaction/Translate.js @@ -59,7 +59,6 @@ const TranslateEventType = { * * @constructor * @extends {module:ol/events/Event} - * @implements {oli.interaction.TranslateEvent} * @param {module:ol/interaction/Translate~TranslateEventType} type Type. * @param {module:ol/Collection.} features The features translated. * @param {module:ol/coordinate~Coordinate} coordinate The event coordinate. diff --git a/src/ol/render/Event.js b/src/ol/render/Event.js index b87046535f..429f0a1f4d 100644 --- a/src/ol/render/Event.js +++ b/src/ol/render/Event.js @@ -7,7 +7,6 @@ import Event from '../events/Event.js'; /** * @constructor * @extends {module:ol/events/Event} - * @implements {oli.render.Event} * @param {module:ol/render/EventType~EventType} type Type. * @param {module:ol/render/VectorContext=} opt_vectorContext Vector context. * @param {module:ol/PluggableMap~FrameState=} opt_frameState Frame state. diff --git a/src/ol/source/Image.js b/src/ol/source/Image.js index 0fc58c7df1..71cca78ddb 100644 --- a/src/ol/source/Image.js +++ b/src/ol/source/Image.js @@ -48,7 +48,6 @@ const ImageSourceEventType = { * * @constructor * @extends {module:ol/events/Event} - * @implements {oli.source.ImageEvent} * @param {string} type Type. * @param {module:ol/Image~Image} image The image. */ diff --git a/src/ol/source/Raster.js b/src/ol/source/Raster.js index 79ec0abc34..144ffa8523 100644 --- a/src/ol/source/Raster.js +++ b/src/ol/source/Raster.js @@ -77,7 +77,6 @@ const RasterOperationType = { * * @constructor * @extends {module:ol/events/Event} - * @implements {oli.source.RasterEvent} * @param {string} type Type. * @param {module:ol/PluggableMap~FrameState} frameState The frame state. * @param {Object} data An object made available to operations. diff --git a/src/ol/source/Tile.js b/src/ol/source/Tile.js index 7666416076..f82f5ff5fe 100644 --- a/src/ol/source/Tile.js +++ b/src/ol/source/Tile.js @@ -329,7 +329,6 @@ TileSource.prototype.useTile = UNDEFINED; * * @constructor * @extends {module:ol/events/Event} - * @implements {oli.source.Tile.Event} * @param {string} type Type. * @param {module:ol/Tile} tile The tile. */ diff --git a/src/ol/source/Vector.js b/src/ol/source/Vector.js index 3e6718783f..23ed48266e 100644 --- a/src/ol/source/Vector.js +++ b/src/ol/source/Vector.js @@ -38,7 +38,6 @@ import RBush from '../structs/RBush.js'; * * @constructor * @extends {module:ol/events/Event} - * @implements {oli.source.Vector.Event} * @param {string} type Type. * @param {module:ol/Feature=} opt_feature Feature. */