UNPKG

ngx-extended-pdf-viewer

Version:

Embedding PDF files in your Angular application. Highly configurable viewer including the toolbar, sidebar, and all the features you're used to.

41 lines (33 loc) 1.19 kB
new (function () { class BrowserCompatibilityTester { // Does your browser doesn't support private fields? #privateField; constructor() { // Does your browser support the logical assignment operators? let x = false; x ||= true; this.#privateMethod(); } // Does your browser doesn't support private methods? #privateMethod() { // check the the browser supports string.at() return 'hello'.at(4); } supportsOptionalChaining() { const optionalChaining = { support: true, }; return optionalChaining?.support; } } function supportsPromiseWithResolvers() { const iframe = document.createElement('iframe'); document.firstElementChild.append(iframe); const useLegacyPdfViewer = 'withResolvers' in iframe.contentWindow['Promise']; iframe.parentElement.removeChild(iframe); return useLegacyPdfViewer; } const supportsOptionalChaining = new BrowserCompatibilityTester().supportsOptionalChaining(); const supportModernPromises = supportsPromiseWithResolvers(); window.ngxExtendedPdfViewerCanRunModernJSCode = supportsOptionalChaining && supportModernPromises; })();