123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import {
- Build
- } from "./chunk-IOZKU7B2.js";
- // node_modules/@esri/calcite-components/dist/components/observers.js
- function createObserver(type, callback, options) {
- if (!Build.isBrowser) {
- return void 0;
- }
- const Observer = getObserver(type);
- return new Observer(callback, options);
- }
- function getObserver(type) {
- class ExtendedMutationObserver extends window.MutationObserver {
- constructor(callback) {
- super(callback);
- this.observedEntry = [];
- this.callback = callback;
- }
- observe(target, options) {
- this.observedEntry.push({ target, options });
- return super.observe(target, options);
- }
- unobserve(target) {
- const newObservedEntries = this.observedEntry.filter((observed) => observed.target !== target);
- this.observedEntry = [];
- this.callback(super.takeRecords(), this);
- this.disconnect();
- newObservedEntries.forEach((observed) => this.observe(observed.target, observed.options));
- }
- }
- return function() {
- return type === "intersection" ? window.IntersectionObserver : type === "mutation" ? ExtendedMutationObserver : window.ResizeObserver;
- }();
- }
- export {
- createObserver
- };
- /*!
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
- * v1.0.0-beta.97
- */
- //# sourceMappingURL=chunk-AVLPSIKF.js.map
|