Reference home > @af-utils/virtual-core > VirtualScroller
VirtualScroller class
Core framework-agnostic model.
Signature:
Remarks
What it does:
-
stores item sizes and positions;
-
tracks elements resizing;
-
provides performant way to calculate offsets;
-
deals with scrolling to item index or to offset;
-
emits and allows to subscribe to events.
What it doesn’t do:
-
rendering;
-
styling;
-
all other framework-related stuff.
Constructors
Constructor |
Modifiers |
Description |
---|---|---|
Constructs a new instance of the |
Properties
Property |
Modifiers |
Type |
Description |
---|---|---|---|
|
number |
Items range start with overscanCount included | |
|
boolean |
Scroll container orientation. | |
|
number |
Sum of all item sizes | |
|
number |
Hash of item sizes. Changed when at least one visible item is resized | |
|
number |
Items range end with overscanCount included | |
|
Returns snapshot of current scroll position. |
Methods
Method |
Modifiers |
Description |
---|---|---|
Start observing size of | ||
End observing size of | ||
Get nearest item index for pixel offset; | ||
Get pixel offset by item index; | ||
Get last cached item size by item index | ||
Subscribe to model events | ||
Scroll to item index | ||
Scroll to pixel offset | ||
Synchronize runtime parameters | ||
Informs model about items container element. Usually not needed. | ||
Notify model about items quantity change | ||
Informs model about scrollable element. | ||
Start observing size of sticky footer | ||
Start observing size of sticky header | ||
Recalculates the offset between scroller element and container element. |