I am using the JavaScript library OpenSeadragon in an Angular 8 app. So the common way is to register the javascript.min.js file in the angular.json scripts
section and use it in TypeScript the following way:
declare var OpenSeadragon: any;
Then I can use the OpenSeadragon in my TypeScript component like this:
const test: any = OpenSeadragon({});
So, that is working.
For this library there are several plugins/extensions. I need to use some of these plugins. They depend on importing the main/core library. So I am adding the plugin's js file in the angular.json scripts
section too.
"scripts": [
"./node_modules/openseadragon/build/openseadragon/openseadragon.min.js",
"./node_modules/openseadragonselection/dist/openseadragonselection.js"
]
The structure of these plugins is that they are extending the core functionality in the following way:
$.Viewer.prototype.selection = function(options) {
if (!this.selectionInstance || options) {
options = options || {};
options.viewer = this;
this.selectionInstance = new $.Selection(options);
}
return this.selectionInstance;
};
For a Viewer object/instance from the main-lib they are introducing a new method called selection({withOptions})
The problem is how can I access the new method in my Angular TypeScript component too? Currently I am getting the error that the method selection does not exist.