Use extends and super for ImageCanvas

This commit is contained in:
ahocevar
2018-07-17 13:45:54 +02:00
parent 61c48ce09f
commit 6ca865375e

View File

@@ -1,7 +1,6 @@
/** /**
* @module ol/ImageCanvas * @module ol/ImageCanvas
*/ */
import {inherits} from './util.js';
import ImageBase from './ImageBase.js'; import ImageBase from './ImageBase.js';
import ImageState from './ImageState.js'; import ImageState from './ImageState.js';
@@ -16,10 +15,7 @@ import ImageState from './ImageState.js';
*/ */
/** class ImageCanvas extends ImageBase {
* @extends {module:ol/ImageBase}
*/
class ImageCanvas {
/** /**
* @param {module:ol/extent~Extent} extent Extent. * @param {module:ol/extent~Extent} extent Extent.
@@ -31,6 +27,10 @@ class ImageCanvas {
*/ */
constructor(extent, resolution, pixelRatio, canvas, opt_loader) { constructor(extent, resolution, pixelRatio, canvas, opt_loader) {
const state = opt_loader !== undefined ? ImageState.IDLE : ImageState.LOADED;
super(extent, resolution, pixelRatio, state);
/** /**
* Optional canvas loader function. * Optional canvas loader function.
* @type {?module:ol/ImageCanvas~Loader} * @type {?module:ol/ImageCanvas~Loader}
@@ -38,10 +38,6 @@ class ImageCanvas {
*/ */
this.loader_ = opt_loader !== undefined ? opt_loader : null; this.loader_ = opt_loader !== undefined ? opt_loader : null;
const state = opt_loader !== undefined ? ImageState.IDLE : ImageState.LOADED;
ImageBase.call(this, extent, resolution, pixelRatio, state);
/** /**
* @private * @private
* @type {HTMLCanvasElement} * @type {HTMLCanvasElement}
@@ -98,7 +94,5 @@ class ImageCanvas {
} }
} }
inherits(ImageCanvas, ImageBase);
export default ImageCanvas; export default ImageCanvas;