String
init : DomId -> Dir -> InfScroll
InfScroll.init "item-list" InfScroll.Bottom
|> setOffset 100
setDir : Dir -> InfScroll -> InfScroll
setOffset : Basics.Int -> InfScroll -> InfScroll
setInterval : Basics.Float -> InfScroll -> InfScroll
subscriptions : InfScroll -> Platform.Sub.Sub Msg
update : Msg -> InfScroll -> ( InfScroll, Platform.Cmd.Cmd Msg )
whenLoadMore : (Msg -> msg) -> Platform.Cmd.Cmd msg -> ( InfScroll, Platform.Cmd.Cmd Msg ) -> ( InfScroll, Platform.Cmd.Cmd msg )
MapInfScroll subMsg ->
let
(newInfScroll, cmd) =
InfScroll.update subMsg model.infScroll
|> InfScroll.whenLoadMore MapInfScroll getItems
in
( { model | infScroll = newInfScroll }
, cmd
)
toLoaded : InfScroll -> InfScroll
GotItems items ->
( { model
| items =
List.sort (model.items ++ items)
, infScroll =
if List.isEmpty items then
InfScroll.toStop model.infScroll
else
InfScroll.toLoaded model.infScroll
}
, Cmd.none
)
toStop : InfScroll -> InfScroll
view : InfScroll -> List (Html.Attribute msg) -> List (Html.Attribute msg) -> List (Html msg) -> Html msg
InfScroll.view model.infScroll
(InfScroll.defaultContainerAttrs infScroll)
(InfScroll.defaultItemsAttrs infScroll)
(List.map viewItem model.items)
defaultContainerAttrs : InfScroll -> List (Html.Attribute msg)
defaultItemsAttrs : InfScroll -> List (Html.Attribute msg)
getDir : InfScroll -> Dir
getStatus : InfScroll -> Status
getViewport : InfScroll -> Maybe Browser.Dom.Viewport