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
- data Decoder a = Decoder {
- decoder :: Value -> Parser a
- decodeAt :: DecodeTarget
- data DecodeTarget
- = DecodeTarget [MisoString]
- | DecodeTargets [[MisoString]]
- at :: [MisoString] -> (Value -> Parser a) -> Decoder a
- emptyDecoder :: Decoder ()
- keycodeDecoder :: Decoder KeyCode
- keyInfoDecoder :: Decoder KeyInfo
- checkedDecoder :: Decoder Checked
- valueDecoder :: Decoder MisoString
Decoder
Decoder data type for parsing events
data DecodeTarget Source #
Data type representing path (consisting of field names) within event object, where a decoder should be applied.
DecodeTarget [MisoString] | Specify single path within Event object, where a decoder should be applied. |
DecodeTargets [[MisoString]] | Specify multiple paths withing Event object, where decoding should be attempted. The first path where decoding suceeds is the one taken. |
Instances
ToJSVal DecodeTarget Source # | |
Defined in Miso.Event.Decoder toJSVal :: DecodeTarget -> IO JSVal Source # toJSValListOf :: [DecodeTarget] -> IO JSVal Source # |
at :: [MisoString] -> (Value -> Parser a) -> Decoder a Source #
Smart constructor for building a Decoder
.
Decoders
emptyDecoder :: Decoder () Source #
Empty decoder for use with events like "click" that do not return any meaningful values
keycodeDecoder :: Decoder KeyCode Source #
Retrieves either "keyCode", "which" or "charCode" field in Decoder
keyInfoDecoder :: Decoder KeyInfo Source #
Retrieves either "keyCode", "which" or "charCode" field in Decoder
, along with shift, ctrl, meta and alt.
checkedDecoder :: Decoder Checked Source #
Retrieves "checked" field in Decoder
valueDecoder :: Decoder MisoString Source #
Retrieves "value" field in Decoder