Module

Bonsai.DOM

Package
purescript-bonsai
Repository
grmble/purescript-bonsai

Bonsai DOM Helpers

#affElementById Source

affElementById :: forall eff. ElementId -> Document -> Aff (bonsai :: BONSAI | eff) Element

Get a DOM element in a Aff context

This represents failure as Aff error

#affElementAction Source

affElementAction :: forall a eff. (Element -> Eff (bonsai :: BONSAI | eff) a) -> ElementId -> Document -> Aff (bonsai :: BONSAI | eff) a

Helper for calling effectful actions on dom nodes.

This uses a short delay to let the render happen before trying to find the element.

#focusCmd Source

focusCmd :: forall msg eff. ElementId -> Cmd (bonsai :: BONSAI | eff) msg

Cmd that will set the focus to the input field.

#focusSelectCmd Source

focusSelectCmd :: forall msg eff. ElementId -> Cmd (bonsai :: BONSAI | eff) msg

Cmd that will set the focus and select the input field

Re-exports from Bonsai.DOM.Primitive

#RequestAnimationFrameId Source

newtype RequestAnimationFrameId

The ID of a request animation frame

Constructors

#ElementId Source

newtype ElementId

The ID of an element in the DOM

Constructors

#Element Source

newtype Element

A DOM Element

Constructors

#window Source

window :: forall eff. Eff (bonsai :: BONSAI | eff) Window

Get the global javascript Window object

#textContent Source

textContent :: forall eff. Element -> Eff (bonsai :: BONSAI | eff) String

Get the element's text content

#selectInputElementText Source

selectInputElementText :: forall eff. Element -> Eff (bonsai :: BONSAI | eff) Unit

Select the input elements text.

#requestAnimationFrame Source

requestAnimationFrame :: forall eff. Eff (bonsai :: BONSAI | eff) Unit -> Window -> Eff (bonsai :: BONSAI | eff) RequestAnimationFrameId

Request an animation frame.

#focusElement Source

focusElement :: forall eff. Element -> Eff (bonsai :: BONSAI | eff) Unit

Focus the element

#elementById Source

elementById :: forall eff. ElementId -> Document -> Eff (bonsai :: BONSAI | eff) (Maybe Element)

Get the element identified by id.

#document Source

document :: forall eff. Window -> Eff (bonsai :: BONSAI | eff) Document

Get the global javascript Document object

#clearElement Source

clearElement :: forall eff. Element -> Eff (bonsai :: BONSAI | eff) Unit

Clear the element.

Removes all child nodes of the element.

#appendChild Source

appendChild :: forall eff. Element -> Element -> Eff (bonsai :: BONSAI | eff) Unit

Append the child

The container/parent is the second argument!