How to extends ViewOptions from Openlayers package

35 views Asked by At

I have an interface and I want to extend ViewOptions but I can not find where it is in the package ol.

Someone can indicate me where the ViewOptions is ?

1

There are 1 answers

0
ahocevar On BEST ANSWER

When working with the ol package, you do not need to do anything to add options. This is also why the externs/olx.js file is not part of the package.

So what you do is just pass your custom additional option to your View subclass's constructor, and use it. Something like:

import View from 'ol/view';
import ol from 'ol';

var CustomView = function(options) {
  this.customOption = options.customOption;
}
ol.inherits(CustomView, View);

var myView = new CustomView({customOption: 'foo'});
console.log(myView.customOption); // > 'foo'