Fork me on GitHub
#hoplon
<
2019-02-15
>
ro602:02:22

I see this pattern in several demos (such as: https://github.com/hoplon/demos/blob/master/todoFRP/src/index.cljs.hl#L91), but when I try to replicate it I get an error since arg-1 to the :change handler is a js/Event object, which doesn't support IDeref. Can someone explain this to me?

alandipert18:02:41

@robert.mather.rmm at least when the demos were written, e was a jquery event object, and we extended IDeref to it... you could do the same to make it work

alandipert18:02:57

i think maybe since jquery became optional that was removed, i don't know for sure though

ro618:02:52

I suspected something like that. Sounds likely to me. So I could just extend IDeref to the native Event type?

alandipert18:02:01

you can, yeah. shouldn't cause any problems, although extending the native types is poo-poo'd in some circles

alandipert18:02:26

since you're effectively mutating a global thing and whatnot

alandipert18:02:37

but hey, it's pretty convenient

flyboarder21:02:54

@robert.mather.rmm make sure you are including the hoplon.jquery namespace

flyboarder21:02:25

hoplon.core + your attribute provider (usually jquery but could also be google closure)

ro621:02:04

@flyboarder Got it. Is that because the providers are set up via multimethods?

flyboarder21:02:19

yes, and they are optional, there is a minimal amount of supported attributes via vanilla js but usually you will want the jquery provider