Closed valdrinkoshi closed 6 years ago
I pushed more readme updates. One thing I was thinking is that resetting recycleElement should not reset createElement. It would be nice to be able to turn off recycling while still getting default element creation. What do you think?
Uhm, yeah that should be possible. So:
createElement
, we should set recycleElement
to null (if it's still the default).recycleElement
, we should just empty the nodePool, so that the default createElement
will always create new children.Yep, that sounds perfect to me.
Done 👌 There is a chance for this to be a shotgun for the user, for example if the user sets recycleElement !== null
while keeping the default createElement
, they'll be effectively keeping those elements in the dom while creating new elements. But I feel like that's an edge case, I expect the user to set createElement
and recycleElement
within the same RAF.
Fixes #80. With these new defaults, the user only needs to set
updateElement
to effectively customize the rendering.virtual-scroller
creates a<div>
as a child template, but this can be customized by distributing a<template>
with any element into the scroller. The scroller will recycle these children by default.Updated README.md and couple demos as an example of usage.