v1ack / svelte-virtual-scroll-list

Virtualized scrolling for big lists
https://v1ack.github.io/svelte-virtual-scroll-list/
MIT License
114 stars 18 forks source link

updated event #13

Open gVguy opened 1 year ago

gVguy commented 1 year ago

I would appreciate if this library implemented an updated event fired from the VirtualList component each time the rendered items are updated.

Can be something as simple as afterUpdate(() => dispatch('updated'))

It would help a great deal thank you.

v1ack commented 1 year ago

Can you explain how you are going to use it?

gVguy commented 1 year ago

I ended up writing my own virtual list component to suit my needs, but I still recommend that you add this functionality, since it's very easy to implement and can be useful to someone in the future.

Updated event is necessary for when the user needs to interact with the DOM directly (for example with third party libraries) every time new items are rendered to the view. And the only way to track that DOM update is by listening to such event.

You can see some other thematic packages implementing this functionality, eg: