This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-08
Channels
- # 100-days-of-code (1)
- # announcements (7)
- # beginners (63)
- # cljs-dev (39)
- # clojure (78)
- # clojure-dev (40)
- # clojure-italy (4)
- # clojure-nl (22)
- # clojure-russia (5)
- # clojure-spec (5)
- # clojurescript (60)
- # cursive (8)
- # datomic (6)
- # emacs (1)
- # figwheel-main (53)
- # fulcro (19)
- # jobs-discuss (11)
- # mount (1)
- # off-topic (3)
- # om (1)
- # pedestal (9)
- # philosophy (1)
- # re-frame (19)
- # reagent (4)
- # reitit (5)
- # shadow-cljs (66)
- # tools-deps (64)
hey, having a hard time trying to get an external lib loaded - I’ve made an extern for it, but can’t seem to help the compiler find it - https://github.com/dazld/hello-hdom/blob/master/project.clj < any ideas?
@dazld It is complaining that it can’t find the hdom
namespace here, right? https://github.com/dazld/hello-hdom/blob/master/src/hello_hdom/core.cljs#L4
@dazld Since you are using figwheel.main
and not cljsbuild
, your compiler options would go into, say, dev.cljs.edn
, I would imagine
now getting:
Compile Warning src/hello_hdom/core.cljs
Use of undeclared Var hello-hdom.core/hdom
I’d like to stick with lein if possible, as this will have some server side elements too
WARNING: JavaScript file found on classpath for library `hdom`, but does not contain a corresponding `goog.provide` declaration: file:/Users/dan/projects/cljs/hello-hdom/foreign/hdom.js
@dazld what is hdom
? where is that from? https://github.com/thi-ng/umbrella/tree/master/packages/hdom?
so did you try either using https://clojurescript.org/guides/webpack or shadow-cljs?
more minimal than npm install @thi.ng/hdom
and (:require ["@thi.ng/hdom" :as hdom])
? 😉
@dazld So it is evidently loading your foreign library now, but you want to reference symbols in it…
See :global-exports
here https://clojurescript.org/reference/compiler-options#foreign-libs
Then in your code it should be as simple as
(ns ...
(:require [hdom]))
(hdom/clearDOM)
@dazld Ahh, you needed to simply put the compiler options directly in the Figwheel compiler options file (not under a :compiler-options
key). Sent a PR with that and example of how to use :global-exports
Hello, can anybody help me on this stackoverflow post? https://stackoverflow.com/questions/52237173/reagent-uikit-dropdown-use Any help is appreciated 🙂
I'd like to bring in a js wast interpreter, to test a wast dsl in cljs https://www.maria.cloud/gist/23d9a94fb30ceda55bb62367775e2f73
That's a dsl based on the wah method here: https://github.com/tmcw/wah/blob/master/doc/intro.md
The maria.cloud gist experiments with fixing up the float interpretation using reader tags. Doesn't really work with how macros work out in maria.cloud though.
I've also implemented a version based on https://deque.blog/2017/01/26/catamorph-your-dsl-clojure/ and another that just composes strings on strings. I'd like to get versions of each up on maria.cloud. But it'd be more useful if produced ast forms could be compiled to wasm in browser and tested live.
es6 modules I believe are JS's answer to namespaces, though closures are the old school hack to make things private
hello 👋. has anyone had any success working out how to do snapshot testing in re-frame?
we started using jest snapshot tests in a js react app at work and it has been a revelation - solves so many of the problems i’ve experienced with f/e tests in one fell swoop - and i’m just starting a new cljs/re-frame app and i’d really like to be able to write snapshot tests for it too
my attempts so far have involved using react-test-renderer-shallow
like this:
(ns caseworker.core-test
(:require [cljs.test :refer-macros [deftest testing is]]
[caseworker.core :as core]
[caseworker.home.views :as layout]
[reagent.core :as reagent]))
(deftest snapshot-test
(testing "snapshot test attempt"
(is (= []
(-> (js/ReactShallowRenderer.)
(.render (-> [home/page]
(reagent/as-element))))))))
(ignore the empty vector, just trying to get a failing test so i can see the output printed)
this works to a point, but it doesn’t descend into nested components in the page component, so is of limited utility
this is the output from that test:
#js{:$$typeof #object[#object[Symbol]],
:type "div",
:key nil,
:ref nil,
:props #js{:children #js[#js{:$$typeof #object[#object[Symbol]],
:type #object[#object[Function]],
:key nil,
:ref nil,
:props #js{:argv [#object[#object[Function]]]},
:_owner nil,
:_store #js{}}
#js{:$$typeof #object[#object[Symbol]],
:type "div",
:key nil,
:ref nil,
:props #js{:className "container-fluid"},
:_owner nil,
:_store #js{}}]},
:_owner nil,
:_store #js{}})
i was wondering if there’s a way to evaluate a reagent component that recursively calls the custom components inside it until you’re left with just “keyword hiccup”, for want of a better way of describing it? haven’t been able to find one yet but not sure what to search for