return [];
        }
    };
};

const setupSonobi: () => Promise<void> = once(() => {
    if (
        dfpEnv.externalDemand === 'none' ||
        !commercialFeatures.dfpAdvertising ||
        commercialFeatures.adFree
    ) {
        return Promise.resolve();
    }
    if (dfpEnv.externalDemand === 'sonobi') {
        buildPageTargeting();
        // Setting the async property to false will _still_ load the script in
        // a non-blocking fashion but will ensure it is executed before googletag
        return loadScript(config.libs.sonobi, { async: false }).then(
            catchPolyfillErrors
        );
    } else if (dfpEnv.externalDemand === 'prebid') {
        buildPageTargeting();
        prebid.initialise();
    }

    return Promise.resolve();
});

const init = (start: () => void, stop: () => void): Promise<void> => {
    start();
    setupSonobi().then(stop);
Beispiel #2
0
            qwery('.js-components-container'),
            'rightHtml'
        );
    }
};

const geoMostPopular = {
    render: once(
        (): Promise<void> => {
            fastdom
                .read(() => {
                    const jsArticleBodyElement = document.querySelector(
                        '.js-article__body'
                    );
                    return jsArticleBodyElement
                        ? jsArticleBodyElement.getBoundingClientRect() &&
                              jsArticleBodyElement.getBoundingClientRect()
                                  .height
                        : 0;
                })
                .then(fetchMostPopular);

            return promise;
        }
    ),

    whenRendered: promise,
};

export { geoMostPopular };