import { isWeChat } from "./environment.mjs";
function getScrollInfo(selector, instanceName) {
  if (!isWeChat && window) {
    const dom = document.querySelector(selector);
    if (!dom)
      return Promise.reject(
        new Error(`getScrollInfo() can't find ${selector} dom.`)
      );
    return Promise.resolve({
      id: dom.id,
      scrollTop: dom.scrollTop,
      scrollLeft: dom.scrollLeft,
      scrollWidth: dom.scrollWidth,
      scrollHeight: dom.scrollHeight
    });
  }
  if (isWeChat) {
    return Promise.reject(
      new Error("uni.getScrollInfo() need instanceName in params.")
    );
  }
  return Promise.reject(new Error("getScrollInfo() occur error"));
}
export {
  getScrollInfo
};
