This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-15
Channels
- # adventofcode (121)
- # bangalore-clj (5)
- # beginners (46)
- # boot-dev (9)
- # cider (20)
- # cljs-dev (7)
- # cljsrn (1)
- # clojure (341)
- # clojure-austin (7)
- # clojure-greece (144)
- # clojure-india (3)
- # clojure-italy (5)
- # clojure-spain (1)
- # clojure-spec (34)
- # clojure-sweden (3)
- # clojure-uk (90)
- # clojurescript (24)
- # core-async (1)
- # core-logic (7)
- # cursive (108)
- # datascript (2)
- # datomic (39)
- # events (1)
- # fulcro (225)
- # graphql (8)
- # hoplon (86)
- # instaparse (12)
- # jobs-discuss (2)
- # jvm (4)
- # keechma (1)
- # lein-figwheel (2)
- # leiningen (12)
- # off-topic (26)
- # onyx (35)
- # other-languages (1)
- # pedestal (3)
- # planck (11)
- # re-frame (12)
- # reagent (12)
- # reitit (5)
- # spacemacs (48)
- # specter (29)
- # sql (2)
- # test-check (1)
- # unrepl (71)
@mfikes @thheller right, I'm trying to create a Grafana plugin, which is supposed to present a SystemJS compatible module when loaded, extend some AngularJS classes, and then expose those extended classes through module exports
This is really in the weeds, for instance, merely including cljs-http - without even using it - is enough to break the plugin and prevent it from loading
Using optimizations: none will also break things, as it results in calls to document.write ... the document has already been closed by this stage, so it effectively blows the entire page away. That's why I'm on whitespace optimizations (now using boot-cljs)
I can export things by banging on js/Window
, but now I'm trying to tidy things up and separate out the ugly JS+Angular interop stuff away from CLJS ... hence starting to use protocols.
I want my implementation on the CLJS side to be "just implement these protocols and you're good" - seems like I have some hackery in the interop layer to make this as seamless as I hope
My first impression: Protocols aren't about interop. (Akin to the way that Clojure has a definterface
that differs from defprotocol
)
But, perhaps you can write an interop layer that does what it needs to do for interop purposes, but then makes use of ClojureScript types that satisfy certain protocols. (That is, if your goal is to have developers to produce ClojureScript that can "plug in" to the framework by satisfying those protocols.)
(The interop layer might be written in JavaScript, or some ClojureScript that plays the right games, making Grafana happy)
That's exactly what I'm thinking now too. I took a number of wrong turns just feeling things out by trial and error, now I'm thinking of protocols as being the thing that makes the CLJS side easier to implement
I'm pretty experienced with JVM interop, but this javascript stuff is really completely the wild west, it's kind of insane
I've had to look at the bytecode and generated classes a couple of times on the JVM, but it's rare. Whereas here I was immediately confronted with that problem
I think the right way to handle this will be to produce a JS artifact that is then imported into a separate JS file, which is then built by webpack or systemjs. Right now I'm trying to do everything in CLJS
Any recommendations for a favorite book or online reference that provides guidance for writing idiomatic clojurescript suitable for programmers with a bit more experience?
@lee.justin.m I think Etudes for ClojureScript looks pretty good too
Is it possible to start a boot-cljs-repl that is connected to a non-interactive browser runtime? Like Nashorn or headless Chrome? I want to unit test some CLJS code without spinning up a browser
@hagmonk I think that should be possible as long as that non-interactive runtime supports websockets
@martinklepsch I'm thinking of hacking something together that works like boot-cljs-reload, except behind the scenes it starts chrome headless and sends across javascript via the devtools protocol ...
@hagmonk couldn’t you just use chrome-headless with boot-reload though? you can open an html file and it does support websockets and all that no?
@martinklepsch yeah! that's what I'm doing for the time being ... just occurred to me that it would be good to cut out some extra ceremony. So you say "give me a REPL" and we fire up headless chrome, and just start shoveling compiled JS into it. No websockets or anything.
@martinklepsch and there are additional benefits over doing the same thing with node, such as being able to capture screenshots, profile the browser ... the more I look at the devtools api, the more interesting it becomes
@martinklepsch and now I just found https://github.com/tatut/clj-chrome-devtools, which looks perfect to run an experiment with ... and as an aside, looks like an exemplary modern Clojure project.