MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / constructor

Method constructor

src/utils/VirtualScroller.ts:101–120  ·  view source on GitHub ↗
(options: VirtualScrollerOptions<T>)

Source from the content-addressed store, hash-verified

99 private invalidatedKeys = new Set<string>();
100
101 constructor(options: VirtualScrollerOptions<T>) {
102 this.container = options.container;
103 this.items = options.items;
104 this.estimatedHeight = options.itemHeight ?? 0; // Will be calculated if not provided
105 this.overscan = options.overscan ?? 5;
106 this.renderItem = options.renderItem;
107 this.getItemKey = options.getItemKey ?? ((item, index) => String(index));
108
109 this.setupDOM();
110 this.attachScrollListener();
111 this.setupResizeObserver();
112
113 // If no itemHeight provided, calculate from sample
114 if (!options.itemHeight && this.items.length > 0) {
115 this.calculateEstimatedHeight();
116 }
117
118 this.rebuildPositionCache();
119 this.updateVisibleRange();
120 }
121
122 private setupDOM(): void {
123 // Clear existing content

Callers

nothing calls this directly

Calls 6

setupDOMMethod · 0.95
attachScrollListenerMethod · 0.95
setupResizeObserverMethod · 0.95
rebuildPositionCacheMethod · 0.95
updateVisibleRangeMethod · 0.95

Tested by

no test coverage detected