title: How to debounce elm signals?
body: <p>Im using <code>start-app</code> to shape my application. <code>Html.Events</code> supports creating custom events with custom <code>Signal.message</code>. But how to send that message is abstracted behind the Html library. Also there is a library called which implements debouncing (<a href="http://package.elm-lang.org/packages/Apanatshka/elm-signal-extra/5.7.0/Signal-Time#settledAfter" rel="nofollow">http://package.elm-lang.org/packages/Apanatshka/elm-signal-extra/5.7.0/Signal-Time#settledAfter</a>).</p>
  
  <p>SearchBar.elm:</p>
  
  <pre><code>module PhotosApp.SearchBar (view) where
  
  import Html exposing (input, div, button, text, Html)
  import Html.Events exposing (on, onClick, targetValue)
  import Html.Attributes exposing (value, type')
  
  import Effects exposing (Effects, Never)
  
  import PhotosApp.Actions as Actions
  
  onTextChange : Signal.Address a -&gt; (String -&gt; a) -&gt; Html.Attribute
  onTextChange address contentToValue =
      on "input" targetValue (\str -&gt; Signal.message address (contentToValue str))
  
  view : Signal.Address Actions.Action -&gt; String -&gt; Html
  view address model =
      div []
          [ input  [ type' "text", value model, onTextChange address Actions.Search] []
          , button [ onClick address Actions.Clear ] [text "Clear"]
          ]
  </code></pre>