hyperbole-0.5.0: Interactive HTML apps using type-safe serverside Haskell
Safe HaskellNone
LanguageGHC2021

Web.Hyperbole.HyperView.Event

Synopsis

Documentation

onLoad :: (ViewAction (Action id), ViewContext a ~ id, Attributable a) => Action id -> DelayMs -> Attributes a -> Attributes a Source #

Send the action after N milliseconds. Can be used to implement lazy loading or polling. See Example.Page.Concurrent

#EMBED ExamplePageConcurrency.hs viewTaskLoad

onInput :: (ViewAction (Action id), ViewContext a ~ id, Attributable a) => (Text -> Action id) -> DelayMs -> Attributes a -> Attributes a 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

onChange :: (ViewAction (Action id), ViewContext a ~ id, Attributable a) => (value -> Action id) -> Attributes a -> Attributes a Source #

data Key Source #

Instances

Instances details
Read Key Source # 
Instance details

Defined in Web.Hyperbole.HyperView.Event

Show Key Source # 
Instance details

Defined in Web.Hyperbole.HyperView.Event

Methods

showsPrec :: Int -> Key -> ShowS #

show :: Key -> String #

showList :: [Key] -> ShowS #

toActionInput :: ViewAction a => (val -> a) -> Encoded Source #

Serialize a constructor that expects a single input, like `data MyAction = GoSearch Text`

dataTarget :: (ViewId id, ViewContext a ~ id, Attributable a) => id -> Attributes a -> Attributes a Source #

Internal

target :: (HyperViewHandled id ctx, ViewId id) => id -> View id () -> View ctx () Source #

Allow inputs to trigger actions for a different view

#EMBED ExamplePageAdvanced.hs targetView