#EventHandler Source

type EventHandler = EffectFn1 SyntheticEvent Unit

An event handler, which receives a SyntheticEvent and performs some effects in return.

#SyntheticEvent Source

data SyntheticEvent

Event data that we receive from React.

#EventFn Source

newtype EventFn a b

Encapsulates a safe event operation. EventFns can be composed to perform multiple operations.

For example:

input { onChange: handler (preventDefault >>> targetValue)
                    \value -> setState \_ -> { value }


#unsafeEventFn Source

unsafeEventFn :: forall a b. (a -> b) -> EventFn a b

Unsafely create an EventFn. This function should be avoided as it can allow a SyntheticEvent to escape its scope. Accessing a React event's properties is only valid in a synchronous event callback.

Instead, use the helper functions specific to your platform, such as React.Basic.DOM.Events.

#handler Source

handler :: forall a. EventFn SyntheticEvent a -> (a -> Effect Unit) -> EventHandler

Create an EventHandler, given an EventFn and a callback.

For example:

input { onChange: handler targetValue
                    \value -> setState \_ -> { value }

#handler_ Source

handler_ :: Effect Unit -> EventHandler

Create an EventHandler which discards the SyntheticEvent.

For example:

input { onChange: handler_ (setState \_ -> { value })

#merge Source

merge :: forall a fns fns_list r. RowToList fns fns_list => Merge fns_list fns a r => Record fns -> EventFn a (Record r)

Merge multiple EventFn operations and collect their results.

For example:

input { onChange: handler (merge { targetValue, timeStamp })
                    \{ targetValue, timeStamp } -> setState \_ -> { ... }

#Merge Source

class Merge :: RowList Type -> Row Type -> Type -> Row Type -> Constraintclass Merge (rl :: RowList Type) fns a r | rl -> fns, rl a -> r where