Skip to content

Expose DragStart, DragAt and DragEnd Variants #15

@decapo01

Description

@decapo01

I'm building a UI that updates the url when the slider is updated. Currently it's hammering the history API and I'm getting an error in firefox that states Too many calls to Location or History APIs within a short timeframe and the ui freezes. It would be nice to have access to the sub messages (especially DragEnd). All this requires is changing the Msg to Msg(..) in the module exposing statement.

The user would still need to account for the generalized message handling so the example would look something like this

update msg ({ percentageSlider, timeSlider } as model) =
    case msg of
        PercentageSliderMsg m ->
          case m of
            DragEnd _ ->
              -- do whatever you need to do on drag end and return (Model, Cmd)
            _ ->
              let 
                updatedModel = RangeSlider.update m percentageSlider
              in
                ( Model updatedModel timeSlider, Cmd.none )

I'm sure the above can be refactored.

I've already cloned, updated and tested this (manually) and will have a PR soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions