Module

Web.Event.EventTarget

#EventListener

data EventListener :: Type

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

#eventListener

eventListener :: forall a. (Event -> Effect a) -> Effect EventListener

Creates 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

addEventListener :: EventType -> EventListener -> Boolean -> EventTarget -> Effect Unit

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

#removeEventListener

removeEventListener :: EventType -> EventListener -> Boolean -> EventTarget -> Effect Unit

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

#dispatchEvent

dispatchEvent :: Event -> EventTarget -> Effect Boolean

Dispatches an event from an event target.

Re-exports from Web.Event.Internal.Types

#EventTarget

data EventTarget :: Type

A DOM item that can emit events.

Modules