Fork me on GitHub
#hoplon
<
2018-08-13
>
Mandimby Raveloarinjaka02:08:18

Hello everyone, I tried to use Hoplon using a project build using shadow-cljs I ran into an issue but I am not sure whether it is a bug or it is expected. In my main file I only require hoplon.core; as a result multi methods defined in hoplon.jquery are not brought in and Hoplon implementation of IDeref for the jQuery event is not available. To make it work I have to require hoplon.jquery even if I am not using it directly. Now I am not sure whether it is supported to use Hoplon as a library. I was trying to do something similar to https://yogthos.net/posts/2016-06-06-WorkingWithHoplon.html. Thanks in advance for any feedback.

jjttjj02:08:37

@mandimby.raveloarinja that's not a bug it's expected as you need to pull in the do!/on! Multimethod implementations

jjttjj02:08:38

Seems like you're past this point but this is my skeleton project for shadow+hoplon which might be useful https://github.com/jjttjj/shadow-hoplon-starter

jjttjj02:08:48

It's definitely supported to use as a library in this manner.

jjttjj02:08:07

You could define you're own implementations of do!/on! And not depend on jQuery at all, or you could use the hoplon.goog version

Mandimby Raveloarinjaka02:08:06

Indeed that is what I have done. I am not sure it was not explicitly mentioned in the Hoplon wiki. Thank you very much for the feedback.

flyboarder03:08:03

It has a whole page in the wiki 😉

Mandimby Raveloarinjaka03:08:33

Indeed. By default boot-hoplon will auto include the hoplon.jquery attribute provider unless another provider is given to the :refers option of the (hoplon) task. This is to maintain backwards compatibility.

Mandimby Raveloarinjaka03:08:39

Basic thing like do! :value was not working either: silly me for missing that

flyboarder14:08:06

The Readme snipped has the attribute provider but I think we should comment the snippet more, it’s only clear if you can already read hoplon code but it’s easy to miss things like the attribute provider line

flyboarder14:08:01

perhaps we can check for attribute providers via meta data in boot-hoplon

flyboarder14:08:15

(ns hoplon.jquery
  {:hoplon/attribute-provider true})

flyboarder14:08:04

and just warn if we can’t find any