all files / src/polyfills/ polyfill.service.js

71.43% Statements 5/7
62.5% Branches 5/8
100% Functions 4/4
71.43% Lines 5/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40                                                                     
class Polyfill {
 
    constructor() {
 
    }
 
    async fill() {
        return await Promise.all([
            this._documentFragment(),
            this._intersectionObserver(),
        ]);
    }
 
    async _documentFragment() {
        Eif(
            'DocumentFragment' in window &&
            window.DocumentFragment === document.createDocumentFragment().constructor
        ) {
            return true;
        } else {
            return await import('./polyfill.document-fragment');
        }
    }
 
    async _intersectionObserver() {
        Iif(
            'IntersectionObserver' in window &&
            'IntersectionObserverEntry' in window
        ) {
            return true;
        } else {
            return await import('./polyfill.intersection-observer');
        }
    }
 
}
 
export {
    Polyfill,
};