Safe Haskell | None |
---|---|
Language | GHC2021 |
Synopsis
- type DelayMs = Int
- onLoad :: ViewAction (Action id) => Action id -> DelayMs -> Mod id
- onClick :: ViewAction (Action id) => Action id -> Mod id
- onDblClick :: ViewAction (Action id) => Action id -> Mod id
- onInput :: ViewAction (Action id) => (Text -> Action id) -> DelayMs -> Mod id
- onSubmit :: ViewAction (Action id) => Action id -> Mod id
- onKeyDown :: ViewAction (Action id) => Key -> Action id -> Mod id
- onKeyUp :: ViewAction (Action id) => Key -> Action id -> Mod id
- keyDataAttribute :: Key -> Text
- data Key
- toActionInput :: ViewAction a => (Text -> a) -> Text
- onRequest :: Mod id -> Mod id
- dataTarget :: ViewId a => a -> Mod x
- target :: (HyperViewHandled id ctx, ViewId id) => id -> View id () -> View ctx ()
Documentation
onLoad :: ViewAction (Action id) => Action id -> DelayMs -> Mod id Source #
Send the action after N milliseconds. Can be used to implement lazy loading or polling
pollMessageView :: Text ->View
Message () pollMessageView m = do onLoad LoadMessage 1000 $ doel
bold
"Current Message. Reloading in 1s"el_
(text
m)
onDblClick :: ViewAction (Action id) => Action id -> Mod id Source #
onInput :: ViewAction (Action id) => (Text -> Action id) -> DelayMs -> Mod id Source #
Run an action when the user types into an input
or textarea
.
WARNING: a short delay can result in poor performance. It is not recommended to set the value
of the input
input (onInput OnSearch) 250 id
keyDataAttribute :: Key -> Text Source #
ArrowDown | |
ArrowUp | |
ArrowLeft | |
ArrowRight | |
Enter | |
Space | |
Escape | |
Alt | |
CapsLock | |
Control | |
Fn | |
Meta | |
Shift | |
OtherKey Text |
toActionInput :: ViewAction a => (Text -> a) -> Text Source #
Serialize a constructor that expects a single Text
, like `data MyAction = GoSearch Text`
onRequest :: Mod id -> Mod id Source #
Apply a Mod only when a request is in flight
myView = do
el (hide . onRequest flexCol) el_
"Loading..."
el (onRequest hide) Loaded
dataTarget :: ViewId a => a -> Mod x Source #
Internal
target :: (HyperViewHandled id ctx, ViewId id) => id -> View id () -> View ctx () Source #
Trigger actions for another view. They will update the view specified
otherView :: View OtherView () otherView = do el_ "This is not a message view" button OtherAction id "Do Something" target (Message 2) $ do el_ "Now we can trigger a MessageAction which will update our Message HyperView, not this one" button ClearMessage id "Clear Message #2"