Skip to content

Commit

Permalink
split out task/non-task findAttachmentTops
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Feb 17, 2020
1 parent 52f1349 commit adead74
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Main.elm
Expand Up @@ -10,7 +10,7 @@ import Html exposing (Html)
import Html.Attributes as Attrs
import Html.Events
import Json.Decode as Decode
import Task
import Task exposing (Task)


type alias Model =
Expand Down Expand Up @@ -71,15 +71,11 @@ update msg model =
( model, Cmd.none )

AttachmentsMoved tops ->
let
_ =
Debug.log "tops" tops
in
( model, Cmd.none )


findNewAttachmentTops : List Int -> Cmd Msg
findNewAttachmentTops ids =
findNewAttachmentTopsTask : List Int -> Task Never (List ( Int, Float ))
findNewAttachmentTopsTask ids =
-- TODO: this may need Process.sleep 0 to be accurate in all cases
ids
|> List.map
Expand All @@ -90,7 +86,11 @@ findNewAttachmentTops ids =
)
|> Task.sequence
|> Task.map (List.filterMap identity)
|> Task.perform AttachmentsMoved


findNewAttachmentTops : List Int -> Cmd Msg
findNewAttachmentTops ids =
Task.perform AttachmentsMoved (findNewAttachmentTopsTask ids)


view : Model -> Browser.Document Msg
Expand Down

0 comments on commit adead74

Please sign in to comment.