Final ES5 output
My ES6 scenario is this:
export default class Base {
constructor(control_type = 'nominatim', opt_options = {}) {
this.options = utils.mergeOptions(constants.defaultOptions, opt_options);
// ....
}
getLayer() {
return Base.Nominatim.layer;
}
}
ol.inherits(Base, ol.control.Control);
And the ES5 output is this:
var Base = function Base(control_type, opt_options) {
if ( control_type === void 0 ) control_type = 'nominatim';
if ( opt_options === void 0 ) opt_options = {};
this.options = utils.mergeOptions(defaultOptions, opt_options);
};
Base.prototype.getLayer = function getLayer() {
return Base.Nominatim.layer;
};
ol.inherits(Base, ol.control.Control); // this is somehow ignoring Base.prototype methods
return Base;
But if I instantiate this I don't have getLayer
available because ol.inherits(Base, ol.control.Control)
should come right before the prototype's methods, like:
var Base = function Base(control_type, opt_options) {
if ( control_type === void 0 ) control_type = 'nominatim';
if ( opt_options === void 0 ) opt_options = {};
this.options = utils.mergeOptions(defaultOptions, opt_options);
};
ol.inherits(Base, ol.control.Control);
Base.prototype.getLayer = function getLayer() {
return Base.Nominatim.layer;
};
return Base;
Is there any workaround for this?
Thank you Rich.