| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Web.Hyperbole.View.Event
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. See Example.Page.Concurrent
viewUpdating :: Int ->ViewProgress () viewUpdating prg = do let pct = fromIntegral prg / 100 Progress taskId _ <-viewIdcol (onLoad (CheckProgress prg) 0) $ do progressBar pct $ doelgrow $ text $ "Task" <> pack (show taskId)
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 #
Constructors
| 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. See Example.Page.Contact
contactEditView :: User ->ViewContact () contactEditView u = doel(hide . onRequest flexCol) contactLoadingel(onRequest hide) $ contactEditViewSave u
dataTarget :: ViewId a => a -> Mod x Source #
Internal