react-lazily-render-scroll-parent
Version:
Lazily render react components
40 lines (32 loc) • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.default = function (offset) {
if (!offset) {
return undefined;
}
var offsetTop = void 0;
var offsetRight = void 0;
var offsetBottom = void 0;
var offsetLeft = void 0;
if ((typeof offset === 'undefined' ? 'undefined' : _typeof(offset)) === 'object') {
offsetTop = offset.top || 0;
offsetRight = offset.right || 0;
offsetBottom = offset.bottom || 0;
offsetLeft = offset.left || 0;
} else {
offsetTop = offset || 0;
offsetRight = offset || 0;
offsetBottom = offset || 0;
offsetLeft = offset || 0;
}
return {
top: offsetTop,
right: offsetRight,
bottom: offsetBottom,
left: offsetLeft
};
};
require('../types');