All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.frontend.cookieConsentConnector.js Maven / Gradle / Ivy

There is a newer version: 24.5.5
Show newest version
/**
 * @license
 * Copyright 2000-2024 Vaadin Ltd.
 *
 * This program is available under Vaadin Commercial License and Service Terms.
 *
 * See  for the full
 * license.
 */
(function () {
  function copyClassName(consent) {
    const popup = consent._getPopup();
    if (popup) {
      popup.className = consent.className;
    }
  }

  const observer = new MutationObserver((records) => {
    records.forEach((mutation) => {
      if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
        copyClassName(mutation.target);
      }
    });
  });

  window.Vaadin.Flow.cookieConsentConnector = {
    initLazy: function (consent) {
      if (consent.$connector) {
        return;
      }

      consent.$connector = {};

      observer.observe(consent, {
        attributes: true,
        attributeFilter: ['class']
      });

      copyClassName(consent);
    }
  };
})();




© 2015 - 2024 Weber Informatics LLC | Privacy Policy