Skip to content

Commit

Permalink
refactor: organize msg
Browse files Browse the repository at this point in the history
  • Loading branch information
plyr4 committed Feb 2, 2024
1 parent 0e8978a commit 3afa056
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/elm/Shared.elm
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@ update route msg model =
, Effect.none
)

-- FAVICON
Shared.Msg.UpdateFavicon options ->
let
( newFavicon, updateFavicon ) =
Favicons.updateFavicon model.favicon options.favicon
in
( { model | favicon = newFavicon }, updateFavicon |> Effect.sendCmd )

-- TIME
Shared.Msg.AdjustTimeZone options ->
( { model | zone = options.zone }
Expand Down Expand Up @@ -610,14 +618,6 @@ update route msg model =
Interval.FiveSeconds ->
( model, Effect.none )

-- FAVICON
Shared.Msg.UpdateFavicon options ->
let
( newFavicon, updateFavicon ) =
Favicons.updateFavicon model.favicon options.favicon
in
( { model | favicon = newFavicon }, updateFavicon |> Effect.sendCmd )


subscriptions : Route () -> Model -> Sub Msg
subscriptions _ model =
Expand Down
4 changes: 2 additions & 2 deletions src/elm/Shared/Msg.elm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ type Msg
| OnKeyDown { key : String }
| OnKeyUp { key : String }
| VisibilityChanged { visibility : Browser.Events.Visibility }
-- FAVICON
| UpdateFavicon { favicon : Favicons.Favicon }
-- TIME
| AdjustTimeZone { zone : Time.Zone }
| AdjustTime { time : Time.Posix }
Expand Down Expand Up @@ -60,5 +62,3 @@ type Msg
| HandleHttpError (Http.Detailed.Error String)
-- REFRESH
| Tick { interval : Interval.Interval, time : Time.Posix }
-- FAVICON
| UpdateFavicon { favicon : Favicons.Favicon }

0 comments on commit 3afa056

Please sign in to comment.