Web.Event.EventTarget
- Package
- purescript-web-events
- Repository
- purescript-web/purescript-web-events
#EventListener Source
data EventListenerA boxed function that can be used as an event listener. This is necessary due to the underlying implementation of Effect functions.
#eventListener Source
eventListener :: forall a. (Event -> Effect a) -> Effect EventListenerCreates an EventListener from a normal PureScript Effect function.
This function itself is effectful as otherwise it would break referential
transparency - eventListener f /= eventListener f. This is worth noting
as you can only remove the exact event listener value that was added for
an EventTarget.
#addEventListener Source
addEventListener :: EventType -> EventListener -> Boolean -> EventTarget -> Effect UnitAdds a listener to an event target. The boolean argument indicates whether the listener should be added for the "capture" phase.
#addEventListenerWithOptions Source
addEventListenerWithOptions :: EventType -> EventListener -> { capture :: Boolean, once :: Boolean, passive :: Boolean } -> EventTarget -> Effect UnitAdds a listener to an event target.
capture- whether the listener is added to the "capture" phaseonce- if true, indicates listener should be invokved at most once before being automatically removed.passive- indicates the callback function will never callpreventDefault
#removeEventListener Source
removeEventListener :: EventType -> EventListener -> Boolean -> EventTarget -> Effect UnitRemoves a listener to an event target. The boolean argument indicates whether the listener should be removed for the "capture" phase.
#dispatchEvent Source
dispatchEvent :: Event -> EventTarget -> Effect BooleanDispatches an event from an event target.
Re-exports from Web.Event.Internal.Types
#EventTarget Source
data EventTargetA DOM item that can emit events.