Module

DOM.Classy.Event.EventTarget

Package
purescript-dom-classy
Repository
garyb/purescript-dom-classy

#EventTarget Source

class EventTarget t  where

A class for subtypes of EventTarget.

Members

Instances

#eventListener Source

eventListener :: forall a eff event. IsEvent event => (event -> Eff eff a) -> EventListener eff

Creates an event listener from a normal Eff-based callback function, automatically converting to an event subtype. If the conversion fails due to a received event not matching the expected type it will be ignored.

#addEventListener Source

addEventListener :: forall eff t. EventTarget t => EventType -> EventListener (dom :: DOM | eff) -> Boolean -> t -> Eff (dom :: DOM | eff) Unit

Adds a listener to an event target. The boolean argument indicates whether the listener should be added for the "capture" phase.

#removeEventListener Source

removeEventListener :: forall eff t. EventTarget t => EventType -> EventListener (dom :: DOM | eff) -> Boolean -> t -> Eff (dom :: DOM | eff) Unit

Removes a listener to an event target. The boolean argument indicates whether the listener should be removed for the "capture" phase.

#dispatchEvent Source

dispatchEvent :: forall eff event t. EventTarget t => IsEvent event => event -> t -> Eff (dom :: DOM, err :: EXCEPTION | eff) Boolean

Dispatches an event from an event target.

Re-exports from DOM.Event.EventTarget

#EventListener

data EventListener :: Row Effect -> Type

A boxed function that can be used as an event listener. This is necessary due to the underlying implementation of Eff functions.