"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const environment = require("./environment.js");
function getScrollInfo(selector, instanceName) {
  if (!environment.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 (environment.isWeChat) {
    return Promise.reject(
      new Error("uni.getScrollInfo() need instanceName in params.")
    );
  }
  return Promise.reject(new Error("getScrollInfo() occur error"));
}
exports.getScrollInfo = getScrollInfo;
