watchContainerElementCoordinates() {
		const startedAt = Date.now()
		const check = () => {
			// If `VirtualScroller` has been unmounted
			// while `setTimeout()` was waiting, then exit.
			if (!this.isMounted) {
				return
			}
			// Skip comparing `top` coordinate of the list
			// when this function is called the first time.
			if (this.topOffset !== undefined) {
				// Calling `this.getTopOffset()` on an element is about
				// 0.003 milliseconds on a modern desktop CPU,
				// so I guess it's fine calling it twice a second.
				const topOffset = this.getTopOffset()
				if (topOffset !== this.topOffset) {
					this.onUpdateShownItemIndexes({ reason: 'top offset change' })
				}
			}
			// Compare `top` coordinate of the list twice a second
			// to find out if it has changed as a result of loading CSS styles.
			// The total duration of 3 seconds would be enough for any styles to load, I guess.
			// There could be other cases changing the `top` coordinate
			// of the list (like collapsing an "accordeon" panel above the list
			// without scrolling the page), but those cases should be handled
			// by manually calling `.updateLayout()` instance method on `VirtualScroller` instance.
			if (Date.now() - startedAt < WATCH_CONTAINER_ELEMENT_TOP_COORDINATE_MAX_DURATION) {
				this.watchContainerElementCoordinatesTimer = setTimeout(check, WATCH_CONTAINER_ELEMENT_TOP_COORDINATE_INTERVAL)
			}
		}
		// Run the cycle.
		check()
	}
// if it has then it recalculates the shown item indexes.
if it has then it recalculates the shown item indexes.
if it has then it recalculates the shown item indexes .
watchContainerElementCoordinates() {
		const startedAt = Date.now()
		const check = () => {
			if (!this.isMounted) {
				return
			}
			if (this.topOffset !== undefined) {
				const topOffset = this.getTopOffset()
				if (topOffset !== this.topOffset) {
					this.onUpdateShownItemIndexes({ reason: 'top offset change' })
				}
			}
			if (Date.now() - startedAt < WATCH_CONTAINER_ELEMENT_TOP_COORDINATE_MAX_DURATION) {
				this.watchContainerElementCoordinatesTimer = setTimeout(check, WATCH_CONTAINER_ELEMENT_TOP_COORDINATE_INTERVAL)
			}
		}
		check()
	}
watchContainerElementCoordinates ( ) { const startedAt = Date . now ( ) const check = ( ) => { if ( ! this . isMounted ) { return } if ( this . topOffset !== undefined ) { const topOffset = this . getTopOffset ( ) if ( topOffset !== this . topOffset ) { this . onUpdateShownItemIndexes ( { reason : 'top offset change' } ) } } if ( Date . now ( ) - startedAt < WATCH_CONTAINER_ELEMENT_TOP_COORDINATE_MAX_DURATION ) { this . watchContainerElementCoordinatesTimer = setTimeout ( check , WATCH_CONTAINER_ELEMENT_TOP_COORDINATE_INTERVAL ) } } check ( ) }
if it has then it recalculates the shown item indexes.
if it has then it recalculates the shown item indexes .
// If `VirtualScroller` has been unmounted // while `setTimeout()` was waiting, then exit. // Skip comparing `top` coordinate of the list // when this function is called the first time. // Calling `this.getTopOffset()` on an element is about // 0.003 milliseconds on a modern desktop CPU, // so I guess it's fine calling it twice a second. // Compare `top` coordinate of the list twice a second // to find out if it has changed as a result of loading CSS styles. // The total duration of 3 seconds would be enough for any styles to load, I guess. // There could be other cases changing the `top` coordinate // of the list (like collapsing an "accordeon" panel above the list // without scrolling the page), but those cases should be handled // by manually calling `.updateLayout()` instance method on `VirtualScroller` instance. // Run the cycle.