Fork me on GitHub
#clojurescript
<
2017-12-09
>
hagmonk02:12:10

I'm trying to make a Grafana datasource plugin using CLJS, and am rather out of my depth with JS interop ...

hagmonk02:12:24

see <http://docs.grafana.org/plugins/developing/datasources/>

hagmonk02:12:46

"This class has to inherit from the app/plugins/sdk.QueryCtrl class."

hagmonk02:12:20

As far as I can tell, that class will only be present in that relative location at runtime. So that's problem #1 ... problem #2 is how do I sacrifice the right chickens to make it appear as if I did "inherit" from that class?

noisesmith04:12:51

you probably want proxy :)

hagmonk04:12:00

np, I was gonna say "gen-class is available for cljs??" 🙂

hagmonk04:12:37

I'll give that a go ... just wondering what will happen given the JS class I'm deriving from is dynamically loaded by Grafana at runtime …

hagmonk04:12:32

@noisesmith am I missing something, or is proxy not implemented in CLJS either?

Hendrik Poernama11:12:34

@hagmonk you probably want reify

scknkkrer16:12:44

What makes the difference ? I am sorry if it’s a newbie question or it’s obvious. But I really wondering, why…

mfikes16:12:13

@scknkkrer Generally for those kinds of differences, ClojureScript is made to follow Clojure unless there is a really good reason not to. It would be odd for list? to have different semantics.

mfikes19:12:33

@scknkkrer It looks like it has been this way for 5 years and revising that would be a breaking change.

tbaldridge22:12:40

@scknkkrer what is the type of that cons?

tbaldridge22:12:14

interesting, it is a cons....

tbaldridge22:12:50

wow, it's marked as a IList

scknkkrer22:12:12

@mfikes thanks. But it’s bothering me a lot. Maybe one day, If I work hard enough, I can save the library from this tricky parts.

tbaldridge22:12:39

But as mentioned, you probably want to use seq? in almost all of these situations

tbaldridge22:12:20

Infact, in my 7 years of Clojure, I don't think I've used list? in a way that wasn't a bug.

scknkkrer23:12:02

@tbaldridge I solve my problem well. Thank you. But I was feeling really disturbed because it looks like so basic-level and I am trying to figure out the whole big picture. But they explain it well at #clojure.