Skip to content

Getting raw element question #472

Description

@augyg

I am trying to implement code like:

(myDiv, _) <- el' "div" blank
prerender (pure never) $ do
let raw = _element_raw myDiv
addHTMLEventListener raw "some-js-event-that-isn't-apart-of-EventName-datatype" $ \_ -> someLogic

Where addHTMLEventListener is a function I have that uses newEventTrigger

I know that I could put the element in the prerender do statement I am just trying to implement the Template design pattern where I can pass myDiv to a function where I do all my FRP logic, such as making this event listener and what to do with it.

I know that the type/data family RawElement works like so:

RawElement GhcjsDomSpace = GHCJS.Element

but then

RawElement HydrationDomSpace = ()

and I believe consequently : RawElement (DomBuilderSpace m) leads to the compiler complaining

Is there a way to implement this in the way I described or should I just simply put the element in the prerender when I want to add an arbitrary JS event?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions