Remove externs/oli.js

This commit is contained in:
Tim Schaub
2018-05-08 08:38:34 -06:00
parent 750ba4bca4
commit 167bc1ec78
26 changed files with 4 additions and 515 deletions

View File

@@ -10,8 +10,7 @@
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/|\\\\)_",
"include": [
"src",
"externs/oli.js"
"src"
]
},
"plugins": [

View File

@@ -57,14 +57,12 @@ function includeAugments(doclet) {
}
});
}
if (cls.longname.indexOf('oli.') !== 0) {
cls._hideConstructor = true;
delete cls.undocumented;
}
}
}
}
}
function extractTypes(item) {
item.type.names.forEach(function(type) {

View File

@@ -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
/**

View File

@@ -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": [
"*"
],

View File

@@ -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"

View File

@@ -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.<module:ol/Feature~Feature>}
*/
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.<module:ol/Feature~Feature>}
*/
oli.SelectEvent.prototype.deselected;
/**
* @type {Array.<module:ol/Feature~Feature>}
*/
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.<module:ol/Feature~Feature>|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.<module:ol/Feature~Feature>}
*/
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;

View File

@@ -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

View File

@@ -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) {

View File

@@ -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.
*/

View File

@@ -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.

View File

@@ -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.

View File

@@ -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) {

View File

@@ -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
*/

View File

@@ -12,7 +12,6 @@
* {@link module:ol/events/EventTarget~EventTarget}.
*
* @constructor
* @implements {oli.events.Event}
* @param {string} type Type.
*/
const Event = function(type) {

View File

@@ -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.<module:ol/Feature>=} opt_features Features.

View File

@@ -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);

View File

@@ -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.
*/

View File

@@ -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}
*/

View File

@@ -93,7 +93,6 @@ const ModifyEventType = {
*
* @constructor
* @extends {module:ol/events/Event}
* @implements {oli.ModifyEvent}
* @param {ModifyEventType} type Type.
* @param {module:ol/Collection.<module:ol/Feature>} features
* The features modified.

View File

@@ -107,7 +107,6 @@ const SelectEventType = {
* @param {Array.<module:ol/Feature>} deselected Deselected features.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Associated
* {@link module:ol/MapBrowserEvent}.
* @implements {oli.SelectEvent}
* @extends {module:ol/events/Event}
* @constructor
*/

View File

@@ -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.<module:ol/Feature>} features The features translated.
* @param {module:ol/coordinate~Coordinate} coordinate The event coordinate.

View File

@@ -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.

View File

@@ -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.
*/

View File

@@ -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.

View File

@@ -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.
*/

View File

@@ -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.
*/