mutant-scroll
v1.0.2 mutant pull-stream scroller
Mutant-scroll
An infinite scroller for mutant, fed by pull-streams. Heavily inspired by pull-scroll.
Example
const Scroller = require('mutant-scroll')
const scollableContainer = Scroller({
streamToTop,
streamToBottom,
render
})
// => mutant html element <div class='Scroller'>
API
Keys you can provide mutant-scroll:
render
- a function called on each item to render htmlstreamToTop
,streamToBottom
- (one required) at least one is required, is expected to be a pull-stream source.classList
- (optional) an Array of classes to add to the final elementprepend
,append
- (optional) supply array of html elements to insert before or after the streaming content.updateTop
- (optional) a function which is passed(soFar, new)
wherenew
is the incoming value from the top stream, andsoFar
is the scrollers observable Array of values, which you're expected to mutate.updateBottom
- (optional) similar to updateTopstore
- (optional) supply amutant/array
if you want to have external access to it, e.g. for cachingcomparer
- (optional) a function used for the mutant map to compare those things it's rendering overoverflowY
- (optional) over-ride the default inline style over overflow-ycb
- (optional) a callback called when errors happen