Copyright | (C) 2016-2018 David M. Johnson |
---|---|
License | BSD3-style (see the file LICENSE) |
Maintainer | David M. Johnson <djohnson.m@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- on :: MisoString -> Decoder r -> (r -> action) -> Attribute action
- onWithOptions :: Options -> MisoString -> Decoder r -> (r -> action) -> Attribute action
- data Options = Options {}
- defaultOptions :: Options
- onClick :: action -> Attribute action
- onDoubleClick :: action -> Attribute action
- onMouseDown :: action -> Attribute action
- onMouseUp :: action -> Attribute action
- onMouseEnter :: action -> Attribute action
- onMouseLeave :: action -> Attribute action
- onMouseOver :: action -> Attribute action
- onMouseOut :: action -> Attribute action
- onKeyDown :: (KeyCode -> action) -> Attribute action
- onKeyDownWithInfo :: (KeyInfo -> action) -> Attribute action
- onKeyPress :: (KeyCode -> action) -> Attribute action
- onKeyUp :: (KeyCode -> action) -> Attribute action
- onInput :: (MisoString -> action) -> Attribute action
- onChange :: (MisoString -> action) -> Attribute action
- onChecked :: (Checked -> action) -> Attribute action
- onSubmit :: action -> Attribute action
- onBlur :: action -> Attribute action
- onFocus :: action -> Attribute action
- onDrag :: action -> Attribute action
- onDragLeave :: action -> Attribute action
- onDragEnter :: action -> Attribute action
- onDragEnd :: action -> Attribute action
- onDragStart :: action -> Attribute action
- onDragOver :: action -> Attribute action
- onDrop :: AllowDrop -> action -> Attribute action
Custom event handlers
on :: MisoString -> Decoder r -> (r -> action) -> Attribute action Source #
Convenience wrapper for onWithOptions defaultOptions
.
let clickHandler = on "click" emptyDecoder $ \() -> Action in button_ [ clickHandler, class_ "add" ] [ text_ "+" ]
onWithOptions :: Options -> MisoString -> Decoder r -> (r -> action) -> Attribute action Source #
onWithOptions opts eventName decoder toAction
is an attribute
that will set the event handler of the associated DOM node to a function that
decodes its argument using decoder
, converts it to an action
using toAction
and then feeds that action back to the update
function.
opts
can be used to disable further event propagation.
let clickHandler = onWithOptions defaultOptions "click" emptyDecoder $ \() -> Action in button_ [ clickHandler, class_ "add" ] [ text_ "+" ]
Options for handling event propagation.
Instances
Eq Options Source # | |
Show Options Source # | |
Generic Options Source # | |
ToJSVal Options Source # | |
type Rep Options Source # | |
Defined in Miso.Event.Types type Rep Options = D1 (MetaData "Options" "Miso.Event.Types" "miso-1.8.5.0-K4aVQPQg8xr9PmqmPGCBTW" False) (C1 (MetaCons "Options" PrefixI True) (S1 (MetaSel (Just "preventDefault") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool) :*: S1 (MetaSel (Just "stopPropagation") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))) |
defaultOptions :: Options Source #
Default value for Options
.
defaultOptions = Options { preventDefault = False, stopPropagation = False }
Mouse events
onDoubleClick :: action -> Attribute action Source #
onMouseDown :: action -> Attribute action Source #
onMouseEnter :: action -> Attribute action Source #
onMouseLeave :: action -> Attribute action Source #
onMouseOver :: action -> Attribute action Source #
onMouseOut :: action -> Attribute action Source #
Keyboard events
onKeyDownWithInfo :: (KeyInfo -> action) -> Attribute action Source #
onKeyPress :: (KeyCode -> action) -> Attribute action Source #
Form events
onInput :: (MisoString -> action) -> Attribute action Source #
onChange :: (MisoString -> action) -> Attribute action Source #
Focus events
Drag events
onDragLeave :: action -> Attribute action Source #
onDragEnter :: action -> Attribute action Source #
onDragStart :: action -> Attribute action Source #
onDragOver :: action -> Attribute action Source #