tdesign-mobile-vue
Version:
tdesign-mobile-vue
45 lines (41 loc) • 1.28 kB
JavaScript
/**
* tdesign v1.7.0
* (c) 2024 TDesign Group
* @license MIT
*/
import { _ as _classCallCheck, a as _createClass } from '../../_chunks/dep-f1766f7d.mjs';
import { _ as _defineProperty } from '../../_chunks/dep-219bb5a7.mjs';
import '../../_chunks/dep-620d73f7.mjs';
var MockIntersectionObserver = /*#__PURE__*/function () {
function MockIntersectionObserver(callback) {
var _this = this;
_classCallCheck(this, MockIntersectionObserver);
_defineProperty(this, "_callback", void 0);
_defineProperty(this, "_element", void 0);
_defineProperty(this, "trigger", function (event) {
_this._callback([{
isIntersecting: true
}]);
});
this._callback = callback;
}
return _createClass(MockIntersectionObserver, [{
key: "observe",
value: function observe(element) {
this._element = element;
this._element.addEventListener("resize", this.trigger);
}
}, {
key: "unobserve",
value: function unobserve() {
this._element.removeEventListener("resize", this.trigger);
}
}, {
key: "disconnect",
value: function disconnect() {
this._element.removeEventListener("resize", this.trigger);
}
}]);
}();
export { MockIntersectionObserver };
//# sourceMappingURL=utils.mjs.map