"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isWindow = isWindow;
exports.getScrollHeight = getScrollHeight;

/** @description 检测环境是否是window
 * @params { obj ： 目标对象}
 * @return boolean
 * */
function isWindow(obj) {
  return obj != null && obj === obj.window;
}
/**
 * @description 获取到距离顶部的距离
 * @params { target ： 目标对象}
 * @return result 高度
 * */


function getScrollHeight(target) {
  var result = 0;
  if (typeof window === 'undefined') return result; // console.log(target, 'currentTarget')

  if (isWindow(target)) {
    result = target.pageYOffset;
  } else if (target instanceof Document) {
    result = target.documentElement.scrollTop;
  } else {
    result = target.scrollTop;
  }

  return result;
}