mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 10:58:26 +00:00
Throttle search requests
Throttle search requests when typing. Also fix handling subscriptions in main.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
module Util.Update exposing (andThen1)
|
||||
module Util.Update exposing (andThen1, andThen2)
|
||||
|
||||
|
||||
andThen1 : List (a -> ( a, Cmd b )) -> a -> ( a, Cmd b )
|
||||
@ -16,3 +16,23 @@ andThen1 fs a =
|
||||
in
|
||||
List.foldl update init fs
|
||||
|> Tuple.mapSecond Cmd.batch
|
||||
|
||||
|
||||
andThen2 : List (model -> ( model, Cmd msg, Sub msg )) -> model -> ( model, Cmd msg, Sub msg )
|
||||
andThen2 fs m =
|
||||
let
|
||||
init =
|
||||
( m, [], [] )
|
||||
|
||||
update el ( m1, c1, s1 ) =
|
||||
let
|
||||
( m2, c2, s2 ) =
|
||||
el m1
|
||||
in
|
||||
( m2, c2 :: c1, s2 :: s1 )
|
||||
|
||||
combine ( m1, cl, sl ) =
|
||||
( m1, Cmd.batch cl, Sub.batch sl )
|
||||
in
|
||||
List.foldl update init fs
|
||||
|> combine
|
||||
|
Reference in New Issue
Block a user