"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.ScrollPosition = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
class ScrollPosition {
  constructor(params) {
    (0, _defineProperty2.default)(this, "scrollHeight", void 0);
    (0, _defineProperty2.default)(this, "clientHeight", void 0);
    (0, _defineProperty2.default)(this, "scrollTop", void 0);
    this.scrollHeight = params.scrollHeight;
    this.clientHeight = params.clientHeight;
    this.scrollTop = params.scrollTop;
  }
  isScrollDown(other) {
    return this.scrollTop >= other.scrollTop;
  }

  // private reachedBottom(prev: ScrollPosition, offset: number = 0) {
  //   const { scrollHeight } = this;
  //
  //   return this.reachedTo(prev, scrollHeight, offset);
  // }

  reachingTo(prev, bottomX, offsetPX = 0) {
    return this.isScrollDown(prev) && this.reachedTo(bottomX, offsetPX);
  }
  reachedTo(bottomX, offsetPX = 0) {
    const {
      clientHeight,
      scrollTop
    } = this;
    return scrollTop + clientHeight + offsetPX > bottomX;
  }
}
exports.ScrollPosition = ScrollPosition;
//# sourceMappingURL=scrollPosition.js.map