Module
React.Basic.DOM.Components.GlobalEvents
- Package
- purescript-react-basic-dom
- Repository
- lumihq/purescript-react-basic-dom
These helper components register and unregister event callbacks using React's the lifecycle callbacks. They're useful for declaratively defining global behavior which is associated with a particular component being mounted without having to wire all that lifecycle logic up manually.
For example:
render self =
R.div
{ className: "dropdown-wrapper"
, children:
[ dropdownButton
, guard showDropdown $
windowEvent
{ eventType: EventType "click"
, options: defaultOptions
, handler: \_ -> send self CloseDropdown
}
dropdownMenu
]
}
#EventHandlerOptions Source
type EventHandlerOptions = { capture :: Boolean, once :: Boolean, passive :: Boolean }
#globalEvent Source
globalEvent :: EventTarget -> { eventType :: EventType, handler :: Event -> Effect Unit, options :: EventHandlerOptions } -> JSX -> JSX
#globalEvents Source
globalEvents :: EventTarget -> Array { eventType :: EventType, handler :: Event -> Effect Unit, options :: EventHandlerOptions } -> JSX -> JSX
#windowEvent Source
windowEvent :: { eventType :: EventType, handler :: Event -> Effect Unit, options :: EventHandlerOptions } -> JSX -> JSX
- Modules
- React.
Basic. DOM - React.
Basic. DOM. Client - React.
Basic. DOM. Components. GlobalEvents - React.
Basic. DOM. Components. Ref - React.
Basic. DOM. Events - React.
Basic. DOM. Generated - React.
Basic. DOM. Internal - React.
Basic. DOM. SVG - React.
Basic. DOM. Server - React.
Basic. DOM. Simplified. Generated - React.
Basic. DOM. Simplified. ToJSX