Mark optional property with square brackets

This commit is contained in:
Frederic Junod
2018-03-15 15:20:01 +01:00
parent 218ca38f1d
commit 8a4d60192f
12 changed files with 36 additions and 45 deletions

View File

@@ -68,9 +68,9 @@ import {create as createTransform, apply as applyTransform} from './transform.js
* {@link ol.layer.Layer layer-candidate} and it should return a boolean value. * {@link ol.layer.Layer layer-candidate} and it should return a boolean value.
* Only layers which are visible and for which this function returns `true` * Only layers which are visible and for which this function returns `true`
* will be tested for features. By default, all visible layers will be tested. * will be tested for features. By default, all visible layers will be tested.
* @property {number|undefined} hitTolerance Hit-detection tolerance in pixels. Pixels * @property {number} [hitTolerance=0] Hit-detection tolerance in pixels. Pixels
* inside the radius around the given position will be checked for features. This only * inside the radius around the given position will be checked for features. This only
* works for the canvas renderer and not for WebGL. Default is `0`. * works for the canvas renderer and not for WebGL.
*/ */

View File

@@ -35,10 +35,8 @@ import EventType from './events/EventType.js';
/** /**
* @typedef {Object} Options * @typedef {Object} Options
* @property {number|undefined} transition A duration for tile opacity * @property {number} [transition=250] A duration for tile opacity
* transitions. By default, tiles will render with an opacity transition that * transitions in milliseconds. A duration of 0 disables the opacity transition.
* lasts 250 ms. To change the duration, pass a number in milliseconds. A
* duration of 0 disables the opacity transition.
* @api * @api
*/ */
@@ -90,8 +88,7 @@ const Tile = function(tileCoord, state, opt_options) {
* The duration for the opacity transition. * The duration for the opacity transition.
* @type {number} * @type {number}
*/ */
this.transition_ = options.transition === undefined ? this.transition_ = options.transition === undefined ? 250 : options.transition;
250 : options.transition;
/** /**
* Lookup of start times for rendering transitions. If the start time is * Lookup of start times for rendering transitions. If the start time is

View File

@@ -9,7 +9,7 @@ import Zoom from './control/Zoom.js';
/** /**
* @typedef {Object} DefaultsOptions * @typedef {Object} DefaultsOptions
* @property {boolean|undefined} [attribution=true] Include * @property {boolean} [attribution=true] Include
* {@link module:ol/control/Attribution~Attribution}. * {@link module:ol/control/Attribution~Attribution}.
* @property {module:ol/control/Attribution~AttributionOptions} [attributionOptions] * @property {module:ol/control/Attribution~AttributionOptions} [attributionOptions]
* Options for {@link module:ol/control/Attribution~Attribution}. * Options for {@link module:ol/control/Attribution~Attribution}.

View File

@@ -11,13 +11,13 @@ import {listen, unlistenByKey} from '../events.js';
/** /**
* @typedef {Object} Options * @typedef {Object} Options
* @property {Element|undefined} element The element is the control's * @property {Element} [element] The element is the control's
* container element. This only needs to be specified if you're developing * container element. This only needs to be specified if you're developing
* a custom control. * a custom control.
* @property {function(module:ol/MapEvent~MapEvent)|undefined} render Function called when * @property {function(module:ol/MapEvent~MapEvent)} [render] Function called when
* the control should be re-rendered. This is called in a `requestAnimationFrame` * the control should be re-rendered. This is called in a `requestAnimationFrame`
* callback. * callback.
* @property {Element|string|undefined} target Specify a target if you want * @property {Element|string} [target] Specify a target if you want
* the control to be rendered outside of the map's viewport. * the control to be rendered outside of the map's viewport.
*/ */

View File

@@ -34,20 +34,17 @@ const getChangeType = (function() {
/** /**
* @typedef {Object} Options * @typedef {Object} Options
* @property {string|undefined} className CSS class name. Default is * @property {string} [className='ol-full-screen'] CSS class name.
* `'ol-full-screen'`. * @property {string|Element} [label='\u2922'] Text label to use for the button.
* @property {string|Element|undefined} label Text label to use for the button.
* Default is `'\u2922'` (NORTH EAST AND SOUTH WEST ARROW).
* Instead of text, also an element (e.g. a `span` element) can be used. * Instead of text, also an element (e.g. a `span` element) can be used.
* @property {string|Element|undefined} labelActive Text label to use for the * @property {string|Element} [labelActive='\u00d7'] Text label to use for the
* button when full-screen is active. Default is `'\u00d7'` (a cross). * button when full-screen is active.
* Instead of text, also an element (e.g. a `span` element) can be used. * Instead of text, also an element (e.g. a `span` element) can be used.
* @property {string|undefined} tipLabel Text label to use for the button tip. * @property {string} [tipLabel='Toggle full-screen'] Text label to use for the button tip.
* Default is `'Toggle full-screen'`. * @property {boolean} [keys=false] Full keyboard access.
* @property {boolean|undefined} keys Full keyboard access. * @property {Element|string} [target] Specify a target if you want the
* @property {Element|string|undefined} target Specify a target if you want the
* control to be rendered outside of the map's viewport. * control to be rendered outside of the map's viewport.
* @property {Element|string|undefined} source The element to be displayed * @property {Element|string} [source] The element to be displayed
* fullscreen. When not provided, the element containing the map viewport will * fullscreen. When not provided, the element containing the map viewport will
* be displayed fullscreen. * be displayed fullscreen.
*/ */

View File

@@ -50,7 +50,7 @@ GEOMETRY_WRITERS[GeometryType.MULTI_POLYGON] = writeMultiPolygonGeometry;
/** /**
* @typedef {Object} Options * @typedef {Object} Options
* @property {string|undefined} geometryName Geometry name to use when creating features. * @property {string} [geometryName] Geometry name to use when creating features.
*/ */

View File

@@ -30,7 +30,7 @@ import {get as getProjection, equivalent as equivalentProjection, transformExten
* @property {ol.ProjectionLike} featureProjection Projection of the feature geometries * @property {ol.ProjectionLike} featureProjection Projection of the feature geometries
* that will be serialized by the format writer. If not provided, geometries are assumed * that will be serialized by the format writer. If not provided, geometries are assumed
* to be in the `dataProjection` if that is set; in other words, they are not transformed. * to be in the `dataProjection` if that is set; in other words, they are not transformed.
* @property {boolean|undefined} rightHanded When writing geometries, follow the right-hand * @property {boolean} [rightHanded] When writing geometries, follow the right-hand
* rule for linear ring orientation. This means that polygons will have counter-clockwise * rule for linear ring orientation. This means that polygons will have counter-clockwise
* exterior rings and clockwise interior rings. By default, coordinates are serialized * exterior rings and clockwise interior rings. By default, coordinates are serialized
* as they are provided at construction. If `true`, the right-hand rule will * as they are provided at construction. If `true`, the right-hand rule will
@@ -38,7 +38,7 @@ import {get as getProjection, equivalent as equivalentProjection, transformExten
* exterior and counter-clockwise for interior rings). Note that not all * exterior and counter-clockwise for interior rings). Note that not all
* formats support this. The GeoJSON format does use this property when writing * formats support this. The GeoJSON format does use this property when writing
* geometries. * geometries.
* @property {number|undefined} decimals Maximum number of decimal places for coordinates. * @property {number} [decimals] Maximum number of decimal places for coordinates.
* Coordinates are stored internally as floats, but floating-point arithmetic can create * Coordinates are stored internally as floats, but floating-point arithmetic can create
* coordinates with a large number of decimal places, not generally wanted on output. * coordinates with a large number of decimal places, not generally wanted on output.
* Set a number here to round coordinates. Can also be used to ensure that * Set a number here to round coordinates. Can also be used to ensure that

View File

@@ -20,7 +20,7 @@ import {createElementNS, makeArrayPusher, makeArraySerializer, makeChildAppender
/** /**
* @typedef {Object} Options * @typedef {Object} Options
* @property {function(module:ol/Feature~Feature, Node)|undefined} readExtensions Callback function * @property {function(module:ol/Feature~Feature, Node)} [readExtensions] Callback function
* to process `extensions` nodes. To prevent memory leaks, this callback function must * to process `extensions` nodes. To prevent memory leaks, this callback function must
* not store any references to the node. Note that the `extensions` * not store any references to the node. Note that the `extensions`
* node is not allowed in GPX 1.0. Moreover, only `extensions` * node is not allowed in GPX 1.0. Moreover, only `extensions`

View File

@@ -22,9 +22,8 @@ const IGCZ = {
/** /**
* @typedef {Object} Options * @typedef {Object} Options
* @property {IGCZ|string|undefined} altitudeMode Altitude mode. Possible * @property {IGCZ|string} [altitudeMode='none'] Altitude mode. Possible
* values are `'barometric'`, `'gps'`, and `'none'`. Default * values are `'barometric'`, `'gps'`, and `'none'`.
* is `'none'`.
*/ */

View File

@@ -24,16 +24,16 @@ import RenderFeature from '../render/Feature.js';
/** /**
* @typedef {Object} Options * @typedef {Object} Options
* @property {undefined|function((module:ol/geom/Geometry~Geometry|Object.<string,*>)=)|function(module:ol/geom/GeometryType~GeometryType,Array.<number>,(Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)} featureClass * @property {function((module:ol/geom/Geometry~Geometry|Object.<string,*>)=)|function(module:ol/geom/GeometryType~GeometryType,Array.<number>,(Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)} [featureClass]
* Class for features returned by {@link ol.format.MVT#readFeatures}. Set to * Class for features returned by {@link ol.format.MVT#readFeatures}. Set to
* {@link module:ol/Feature~Feature} to get full editing and geometry support at the cost of * {@link module:ol/Feature~Feature} to get full editing and geometry support at the cost of
* decreased rendering performance. The default is {@link ol.render.Feature}, * decreased rendering performance. The default is {@link ol.render.Feature},
* which is optimized for rendering and hit detection. * which is optimized for rendering and hit detection.
* @property {string|undefined} geometryName Geometry name to use when creating * @property {string} [geometryName='geometry'] Geometry name to use when creating
* features. Default is `'geometry'`. * features.
* @property {string|undefined} layerName Name of the feature attribute that * @property {string} [layerName='layer'] Name of the feature attribute that
* holds the layer name. Default is `'layer'`. * holds the layer name.
* @property {Array.<string>|undefined} layers Layers to read features from. If not * @property {Array.<string>} [layers] Layers to read features from. If not
* provided, features will be read from all layers. * provided, features will be read from all layers.
*/ */

View File

@@ -19,8 +19,8 @@ import SimpleGeometry from '../geom/SimpleGeometry.js';
/** /**
* @typedef {Object} Options * @typedef {Object} Options
* @property {boolean|undefined} splitCollection Whether to split GeometryCollections into * @property {boolean} [splitCollection=false] Whether to split GeometryCollections into
* multiple features on reading. Default is `false`. * multiple features on reading.
*/ */

View File

@@ -7,18 +7,16 @@ import {METERS_PER_UNIT} from '../proj/Units.js';
/** /**
* @typedef {Object} Options * @typedef {Object} Options
* @property {string} code The SRS identifier code, e.g. `EPSG:4326`. * @property {string} code The SRS identifier code, e.g. `EPSG:4326`.
* @property {module:ol/proj/Units~Units|string|undefined} units Units. Required unless a * @property {module:ol/proj/Units~Units|string} [units] Units. Required unless a
* proj4 projection is defined for `code`. * proj4 projection is defined for `code`.
* @property {module:ol/extent~Extent} [extent] The validity extent for the SRS. * @property {module:ol/extent~Extent} [extent] The validity extent for the SRS.
* @property {string|undefined} axisOrientation The axis orientation as specified * @property {string} [axisOrientation='enu'] The axis orientation as specified in Proj4.
* in Proj4. The default is `enu`. * @property {boolean} [global=false] Whether the projection is valid for the whole globe.
* @property {boolean|undefined} global Whether the projection is valid for the * @property {number} [metersPerUnit] The meters per unit for the SRS.
* whole globe. Default is `false`.
* @property {number|undefined} metersPerUnit The meters per unit for the SRS.
* If not provided, the `units` are used to get the meters per unit from the {@link module:ol/proj/Units~METERS_PER_UNIT} * If not provided, the `units` are used to get the meters per unit from the {@link module:ol/proj/Units~METERS_PER_UNIT}
* lookup table. * lookup table.
* @property {module:ol/extent~Extent} [worldExtent] The world extent for the SRS. * @property {module:ol/extent~Extent} [worldExtent] The world extent for the SRS.
* @property {(function(number, module:ol/coordinate~Coordinate):number|undefined)} getPointResolution * @property {function(number, module:ol/coordinate~Coordinate):number} [getPointResolution]
* Function to determine resolution at a point. The function is called with a * Function to determine resolution at a point. The function is called with a
* `{number}` view resolution and an `{module:ol/coordinate~Coordinate}` as arguments, and returns * `{number}` view resolution and an `{module:ol/coordinate~Coordinate}` as arguments, and returns
* the `{number}` resolution at the passed coordinate. If this is `undefined`, * the `{number}` resolution at the passed coordinate. If this is `undefined`,