Start search by pressing enter and not on each stroke

This reduces (unecessary) requests and eases the restless list
rendering. Throttling is still in place to avoid too many requests
when e.g. holding the enter-key.
This commit is contained in:
Eike Kettner
2020-06-22 00:35:11 +02:00
parent 6c8abf4cd7
commit 5e77ff0fc5
5 changed files with 103 additions and 33 deletions

View File

@ -9,6 +9,7 @@ module Util.Html exposing
, onDragOver
, onDropFiles
, onKeyUp
, onKeyUpCode
)
import File exposing (File)
@ -76,6 +77,11 @@ onKeyUp tagger =
on "keyup" (D.map tagger keyCode)
onKeyUpCode : (Maybe KeyCode -> msg) -> Attribute msg
onKeyUpCode tagger =
onKeyUp (intToKeyCode >> tagger)
onClickk : msg -> Attribute msg
onClickk msg =
Html.Events.preventDefaultOn "click" (D.map alwaysPreventDefault (D.succeed msg))