Replace instanceof checks with other logic

This commit is contained in:
ahocevar
2018-10-05 16:16:51 +02:00
parent 96e99e481e
commit 9163558511
40 changed files with 232 additions and 268 deletions
+1 -2
View File
@@ -84,9 +84,8 @@ class LayerGroup extends BaseLayer {
if (Array.isArray(layers)) {
layers = new Collection(layers.slice(), {unique: true});
} else {
assert(layers instanceof Collection,
assert(typeof /** @type {?} */ (layers).getArray === 'function',
43); // Expected `layers` to be an array or a `Collection`
layers = layers;
}
} else {
layers = new Collection(undefined, {unique: true});
+3 -3
View File
@@ -41,7 +41,7 @@ import {createDefaultStyle, toFunction as toStyleFunction} from '../style/Style.
* @property {boolean} [declutter=false] Declutter images and text. Decluttering is applied to all
* image and text styles, and the priority is defined by the z-index of the style. Lower z-index
* means higher priority.
* @property {import("../style/Style.js").default|Array<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction} [style] Layer style. See
* @property {import("../style/Style.js").StyleLike} [style] Layer style. See
* {@link module:ol/style} for default style which will be used if this is not defined.
* @property {boolean} [updateWhileAnimating=false] When set to `true` and `renderMode`
* is `vector`, feature batches will be recreated during animations. This means that no
@@ -119,7 +119,7 @@ class VectorLayer extends Layer {
/**
* User provided style.
* @type {import("../style/Style.js").default|Array<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction}
* @type {import("../style/Style.js").StyleLike}
* @private
*/
this.style_ = null;
@@ -196,7 +196,7 @@ class VectorLayer extends Layer {
/**
* Get the style for features. This returns whatever was passed to the `style`
* option at construction or to the `setStyle` method.
* @return {import("../style/Style.js").default|Array<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction}
* @return {import("../style/Style.js").StyleLike}
* Layer style.
* @api
*/
+2 -2
View File
@@ -70,7 +70,7 @@ export const RenderType = {
* image and text styles, and the priority is defined by the z-index of the style. Lower z-index
* means higher priority. When set to `true`, a `renderMode` of `'image'` will be overridden with
* `'hybrid'`.
* @property {import("../style/Style.js").default|Array<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction} [style] Layer style. See
* @property {import("../style/Style.js").StyleLike} [style] Layer style. See
* {@link module:ol/style} for default style which will be used if this is not defined.
* @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will be
* recreated during animations. This means that no vectors will be shown clipped, but the setting
@@ -82,7 +82,7 @@ export const RenderType = {
* means no preloading.
* @property {import("../render.js").OrderFunction} [renderOrder] Render order. Function to be used when sorting
* features before rendering. By default features are drawn in the order that they are created.
* @property {import("../style/Style.js").default|Array<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction} [style] Layer style. See
* @property {import("../style/Style.js").StyleLike} [style] Layer style. See
* {@link module:ol/style} for default style which will be used if this is not defined.
* @property {boolean} [useInterimTilesOnError=true] Use interim tiles on error.
*/