Automated class transform

npx lebab --replace src --transform class
This commit is contained in:
Tim Schaub
2018-07-16 16:18:16 -06:00
parent 60e85e7d89
commit 7b4a73f3b9
145 changed files with 32887 additions and 33714 deletions

View File

@@ -51,63 +51,134 @@ import SourceState from '../source/State.js';
* @param {module:ol/source/Source~Options} options Source options.
* @api
*/
const Source = function(options) {
class Source {
constructor(options) {
BaseObject.call(this);
BaseObject.call(this);
/**
* @private
* @type {module:ol/proj/Projection}
*/
this.projection_ = getProjection(options.projection);
/**
* @private
* @type {module:ol/proj/Projection}
*/
this.projection_ = getProjection(options.projection);
/**
* @private
* @type {?module:ol/source/Source~Attribution}
*/
this.attributions_ = this.adaptAttributions_(options.attributions);
/**
* @private
* @type {?module:ol/source/Source~Attribution}
*/
this.attributions_ = this.adaptAttributions_(options.attributions);
/**
* @private
* @type {module:ol/source/State}
*/
this.state_ = options.state !== undefined ?
options.state : SourceState.READY;
/**
* @private
* @type {module:ol/source/State}
*/
this.state_ = options.state !== undefined ?
options.state : SourceState.READY;
/**
* @private
* @type {boolean}
*/
this.wrapX_ = options.wrapX !== undefined ? options.wrapX : false;
/**
* @private
* @type {boolean}
*/
this.wrapX_ = options.wrapX !== undefined ? options.wrapX : false;
};
}
/**
* Turns the attributions option into an attributions function.
* @param {module:ol/source/Source~AttributionLike|undefined} attributionLike The attribution option.
* @return {?module:ol/source/Source~Attribution} An attribution function (or null).
*/
adaptAttributions_(attributionLike) {
if (!attributionLike) {
return null;
}
if (Array.isArray(attributionLike)) {
return function(frameState) {
return attributionLike;
};
}
if (typeof attributionLike === 'function') {
return attributionLike;
}
return function(frameState) {
return [attributionLike];
};
}
/**
* Get the attribution function for the source.
* @return {?module:ol/source/Source~Attribution} Attribution function.
*/
getAttributions() {
return this.attributions_;
}
/**
* Get the projection of the source.
* @return {module:ol/proj/Projection} Projection.
* @api
*/
getProjection() {
return this.projection_;
}
/**
* @abstract
* @return {Array.<number>|undefined} Resolutions.
*/
getResolutions() {}
/**
* Get the state of the source, see {@link module:ol/source/State~State} for possible states.
* @return {module:ol/source/State} State.
* @api
*/
getState() {
return this.state_;
}
/**
* @return {boolean|undefined} Wrap X.
*/
getWrapX() {
return this.wrapX_;
}
/**
* Refreshes the source and finally dispatches a 'change' event.
* @api
*/
refresh() {
this.changed();
}
/**
* Set the attributions of the source.
* @param {module:ol/source/Source~AttributionLike|undefined} attributions Attributions.
* Can be passed as `string`, `Array<string>`, `{@link module:ol/source/Source~Attribution}`,
* or `undefined`.
* @api
*/
setAttributions(attributions) {
this.attributions_ = this.adaptAttributions_(attributions);
this.changed();
}
/**
* Set the state of the source.
* @param {module:ol/source/State} state State.
* @protected
*/
setState(state) {
this.state_ = state;
this.changed();
}
}
inherits(Source, BaseObject);
/**
* Turns the attributions option into an attributions function.
* @param {module:ol/source/Source~AttributionLike|undefined} attributionLike The attribution option.
* @return {?module:ol/source/Source~Attribution} An attribution function (or null).
*/
Source.prototype.adaptAttributions_ = function(attributionLike) {
if (!attributionLike) {
return null;
}
if (Array.isArray(attributionLike)) {
return function(frameState) {
return attributionLike;
};
}
if (typeof attributionLike === 'function') {
return attributionLike;
}
return function(frameState) {
return [attributionLike];
};
};
/**
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
* @param {number} resolution Resolution.
@@ -121,79 +192,4 @@ Source.prototype.adaptAttributions_ = function(attributionLike) {
Source.prototype.forEachFeatureAtCoordinate = UNDEFINED;
/**
* Get the attribution function for the source.
* @return {?module:ol/source/Source~Attribution} Attribution function.
*/
Source.prototype.getAttributions = function() {
return this.attributions_;
};
/**
* Get the projection of the source.
* @return {module:ol/proj/Projection} Projection.
* @api
*/
Source.prototype.getProjection = function() {
return this.projection_;
};
/**
* @abstract
* @return {Array.<number>|undefined} Resolutions.
*/
Source.prototype.getResolutions = function() {};
/**
* Get the state of the source, see {@link module:ol/source/State~State} for possible states.
* @return {module:ol/source/State} State.
* @api
*/
Source.prototype.getState = function() {
return this.state_;
};
/**
* @return {boolean|undefined} Wrap X.
*/
Source.prototype.getWrapX = function() {
return this.wrapX_;
};
/**
* Refreshes the source and finally dispatches a 'change' event.
* @api
*/
Source.prototype.refresh = function() {
this.changed();
};
/**
* Set the attributions of the source.
* @param {module:ol/source/Source~AttributionLike|undefined} attributions Attributions.
* Can be passed as `string`, `Array<string>`, `{@link module:ol/source/Source~Attribution}`,
* or `undefined`.
* @api
*/
Source.prototype.setAttributions = function(attributions) {
this.attributions_ = this.adaptAttributions_(attributions);
this.changed();
};
/**
* Set the state of the source.
* @param {module:ol/source/State} state State.
* @protected
*/
Source.prototype.setState = function(state) {
this.state_ = state;
this.changed();
};
export default Source;