/**
 * ldesign v0.2.3
 * (c) 2022年9月24日 swimly
 * @license MIT
 */

/**
 * LDesignUtility v0.2.1
 * (c) 2022 undefined
 * @license MIT
 */
function observe(element, root, callback, marginBottom) {
  if (!window || !window.IntersectionObserver) {
    callback();
    return null;
  }

  var io = null;

  try {
    io = new window.IntersectionObserver(entries => {
      var entry = entries[0];

      if (entry.isIntersecting) {
        callback();
        io.unobserve(element);
      }
    }, {
      rootMargin: "0px 0px ".concat(marginBottom, "px 0px"),
      root
    });
    io.observe(element);
  } catch (e) {
    console.error(e);
    callback();
  }

  return io;
}

export { observe as o };
//# sourceMappingURL=observe.js.map
