Skip to content

Instantly share code, notes, and snippets.

@Panya
Created October 10, 2016 17:46
Show Gist options
  • Save Panya/9741d7fc99b9d69966b511a77f2eca87 to your computer and use it in GitHub Desktop.
Save Panya/9741d7fc99b9d69966b511a77f2eca87 to your computer and use it in GitHub Desktop.
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Html.App exposing (..)
import Dom
import Task
type Msg
= Click
| NoOp
main =
program
{ init = "" ! []
, view = view
, update = update
, subscriptions = \_ -> Sub.none
}
view model =
div []
[ input [ id "focus-me" ] []
, button [ onClick Click ] [ text "Focus" ]
]
update msg model =
case msg of
Click ->
model ! [Task.perform (always NoOp) (always NoOp) (Dom.focus "focus-me")]
_ ->
model ! []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment