@cantonjs/react-scroll-view
Version:
react scroll component using intersection observer API
38 lines (31 loc) • 1.46 kB
JavaScript
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var RefreshState = function () {
function RefreshState() {
_classCallCheck(this, RefreshState);
}
_createClass(RefreshState, [{
key: "mount",
value: function mount(reactInstance) {
this.reactInstance = reactInstance;
}
}, {
key: "unmount",
value: function unmount() {
this.reactInstance = null;
}
}, {
key: "call",
value: function call(method) {
if (this.reactInstance) {
var _reactInstance;
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
(_reactInstance = this.reactInstance)[method].apply(_reactInstance, args);
}
}
}]);
return RefreshState;
}();
export default RefreshState;