@nteract/monaco-editor
Version:
A React component for the monaco editor, tailored for nteract
53 lines • 1.48 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Polyfill for DOMRect
*/
class DOMRectPolyfill {
constructor(x, y, width, height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
}
/**
* Polyfill for IntersectionObserver
* Always reports the element as intersecting when it is observed.
*/
class AlwaysIntersectingObserver {
constructor(callback) {
this.callback = callback;
/**
* The following methods are not implemented, but are required by the interface.
*/
this.root = null;
this.rootMargin = "";
this.thresholds = [];
}
observe(element) {
const DOMRectImpl = window.DOMRect || DOMRectPolyfill;
// we don't want to cause a reflow if we read the DOM, so we use a dummy rect
const dummyRect = new DOMRectImpl(0, 0, 0, 0);
this.callback([
{
target: element,
isIntersecting: true,
intersectionRatio: 1,
boundingClientRect: dummyRect,
rootBounds: null,
intersectionRect: dummyRect,
time: performance.now()
}
], this);
}
unobserve(element) {
element;
}
disconnect() { }
takeRecords() {
return [];
}
}
exports.default = AlwaysIntersectingObserver;
//# sourceMappingURL=intersectionObserver.js.map