A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add debounced window-resize handler

+39
+35
src/Applications/UI.elm
··· 4 4 import Authentication 5 5 import Authentication.RemoteStorage 6 6 import Browser 7 + import Browser.Events 7 8 import Browser.Navigation as Nav 8 9 import Chunky exposing (..) 9 10 import Color ··· 14 15 import Css exposing (url) 15 16 import Css.Global 16 17 import Css.Transitions 18 + import Debouncer.Basic as Debouncer 17 19 import Dict.Ext as Dict 18 20 import File 19 21 import File.Download ··· 122 124 , queue = Queue.initialModel 123 125 , sources = Sources.initialModel 124 126 , tracks = Tracks.initialModel 127 + 128 + -- Debouncing 129 + ------------- 130 + , debounce = 131 + 0.25 132 + |> Debouncer.fromSeconds 133 + |> Debouncer.debounce 134 + |> Debouncer.toDebouncer 125 135 } 126 136 |> update 127 137 (PageChanged page) ··· 145 155 Bypass -> 146 156 return model 147 157 158 + Debounce debouncerMsg -> 159 + Return3.wieldNested 160 + update 161 + { mapCmd = Debounce 162 + , mapModel = \child -> { model | debounce = child } 163 + , update = \m -> Debouncer.update m >> Return3.fromDebouncer 164 + } 165 + { model = model.debounce 166 + , msg = debouncerMsg 167 + } 168 + 148 169 LoadEnclosedUserData json -> 149 170 model 150 171 |> UserData.importEnclosed json ··· 154 175 model 155 176 |> UserData.importHypaethral json 156 177 |> Return3.wield translateReply 178 + 179 + ResizedWindow ( width, height ) -> 180 + { height = toFloat height 181 + , width = toFloat width 182 + } 183 + |> (\v -> { model | contextMenu = Nothing, viewport = v }) 184 + |> return 157 185 158 186 SetCurrentTime time -> 159 187 let ··· 708 736 , Ports.setAudioIsPlaying SetAudioIsPlaying 709 737 710 738 -- 739 + , Browser.Events.onResize 740 + (\w h -> 741 + ( w, h ) 742 + |> ResizedWindow 743 + |> Debouncer.provideInput 744 + |> Debounce 745 + ) 711 746 , Time.every (60 * 1000) SetCurrentTime 712 747 ] 713 748
+4
src/Applications/UI/Core.elm
··· 6 6 import Browser.Navigation as Nav 7 7 import Common exposing (Switch(..)) 8 8 import ContextMenu exposing (ContextMenu) 9 + import Debouncer.Basic as Debouncer exposing (Debouncer) 9 10 import File exposing (File) 10 11 import Http 11 12 import Json.Encode as Json ··· 39 40 type alias Model = 40 41 { contextMenu : Maybe (ContextMenu Msg) 41 42 , currentTime : Time.Posix 43 + , debounce : Debouncer Msg Msg 42 44 , isLoading : Bool 43 45 , navKey : Nav.Key 44 46 , notifications : List (Notification Msg) ··· 78 80 79 81 type Msg 80 82 = Bypass 83 + | Debounce (Debouncer.Msg Msg) 81 84 | LoadEnclosedUserData Json.Value 82 85 | LoadHypaethralUserData Json.Value 86 + | ResizedWindow ( Int, Int ) 83 87 | SetCurrentTime Time.Posix 84 88 | ToggleLoadingScreen Switch 85 89 -----------------------------------------