Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting raw element question #472

Open
augyg opened this issue May 26, 2024 · 1 comment
Open

Getting raw element question #472

augyg opened this issue May 26, 2024 · 1 comment

Comments

@augyg
Copy link

augyg commented May 26, 2024

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?

@augyg
Copy link
Author

augyg commented May 26, 2024

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant