There are two environments which using the 3rd party library (BrowserPrint.js);
WORKING ENV - JS and jQuery where 3party libraries are included simply in the
<head>
part of the documentand the main function is called in
$(document).ready(setup_web_print);
NOT WORKING ENV - Angular, JS and jQuery
where 3rd party libraries are included in component:
import * as $ from 'jquery'; import * as bp from '../../../content/js/BrowserPrint-1.0.4.js';
and triggered in
ngOnInit()
lifecycle hook:ngOnInit() { $(document).ready(function () { ... }) ... }
There is an error in console
ReferenceError: finishedFunction is not defined at Object.t.getDefaultDevice (BrowserPrint-1.0.4.js:95)
so it seems it cannot access finishedFunction
var a = n("GET", e("available"));
a && (finishedFunction = function(e) {
response = e, response = JSON.parse(response);
for (var n in response)
if (response.hasOwnProperty(n) && response[n].constructor === Array) {
arr = response[n];
for (var i = 0; i < arr.length; ++i) arr[i] = new t.Device(arr[i])
}
return void 0 == o ? void r(response) : void r(response[o])
}, i(void 0, a, finishedFunction, s), a.send())
Does anybody know how to fix this and why doesn't work with in second env?