Skip to content

Instantly share code, notes, and snippets.

@rizary
Created July 5, 2019 03:14
Show Gist options
  • Select an option

  • Save rizary/71599db425fb032bc2ec9d14c1f4b6a2 to your computer and use it in GitHub Desktop.

Select an option

Save rizary/71599db425fb032bc2ec9d14c1f4b6a2 to your computer and use it in GitHub Desktop.
button_ :: forall t m a. (DomBuilder t m, PostBuild t m) => T.Text -> m (Event t ())
button_ t = do
let cfg = (def :: ElementConfig EventResult t (DomBuilderSpace m))
& elementConfig_eventSpec %~ addEventSpecFlags (Proxy :: Proxy (DomBuilderSpace m)) Click (\_ -> preventDefault)
(e, _) <- element "button" cfg $ text t
pure $ domEvent Click e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment