Fork me on GitHub
#clojurescript
<
2019-07-12
>
mfikes00:07:58

A recently-created alternative can be used to put a thin recursive cljs.core/ILookup wrapper around JavaScript objects, making for more familiar / idiomatic use than getValueByKeys for nested access:

(get-in (->clj ui/Responsive) [:onlyMobile :maxWidth])
See https://github.com/mfikes/cljs-bean

👍 4
Roman Liutikov10:07:46

@mfikes Is there anything we should be aware of when using cljs-bean? For example to not mutate passed JS object, etc.

aisamu10:07:55

IIUC it clones the underlying object when you change it via the implemented interfaces (e.g. assoc)

mfikes11:07:34

Yeah, you should not mutate passed objects or arrays. It is true that it also doesn't mutate passed object or arrays.

Schmoho10:07:00

I am currently trying to go through the modern-CLJS tutorials, and figured I might try and set up the boot-environment the author suggests - it works fine so far. One thing that irritates me though: both boot repl -c and CIDER weasel connect seem to reload code on saving files (via boot-reload), but complain about usage of undeclared symbols in the namespace I'm in.

boot serve -d target watch reload cljs-repl cljs target
is the boot-command, I went into my namespace with (in-ns and namespace-file is just one defn. I have the feeling understanding this might be quite important, so I figured I should ask

aisamu10:07:55

IIUC it clones the underlying object when you change it via the implemented interfaces (e.g. assoc)

dpsutton14:07:36

tried to run clojurescript tests against quickjs and it fails with > SyntaxError: functions can only be labelled inside blocks > at builds/out-adv/core-advanced-test.js:183

antonmos14:07:32

hello! does anyone know how to get this to work? * Start Figwheel somewhere * Open a browser session for that Figwheel instance * Connect Cursive to the browser session’s ClojureScript REPL

antonmos15:07:08

yes, but i dont want to run figwheel in Cursive, i want to run it with ‘lein build-dev’

manutter5115:07:31

:thinking_face:

manutter5115:07:45

When I start my Figwheel REPL, it outputs a log message “Starting nREPL server on port: 7002” — do you get a message like that?

antonmos15:07:46

yup. here is what i tried I tried starting Remote Repl in Cursive, switching it to CLJS, then running (figwheel.main.api/cljs-repl "dev") i get the following output

Connecting to remote nREPL server...
Clojure 1.10.1
(figwheel.main.api/cljs-repl "dev")
Prompt will show when REPL connects to evaluation environment (i.e. a REPL hosting webpage)
Figwheel Main Controls:
          (figwheel.main/stop-builds id ...)  ;; stops Figwheel autobuilder for ids
          (figwheel.main/start-builds id ...) ;; starts autobuilder focused on ids
          (figwheel.main/reset)               ;; stops, cleans, reloads config, and starts autobuilder
          (figwheel.main/build-once id ...)   ;; builds source one time
          (figwheel.main/clean id ...)        ;; deletes compiled cljs target files
          (figwheel.main/status)              ;; displays current state of system
Figwheel REPL Controls:
          (figwheel.repl/conns)               ;; displays the current connections
          (figwheel.repl/focus session-name)  ;; choose which session name to focus on
In the cljs.user ns, controls can be called without ns ie. (conns) instead of (figwheel.repl/conns)
    Docs: (doc function-name-here)
    Exit: :cljs/quit
 Results: Stored in vars *1, *2, *3, *e holds last exception object
Execution error (ExceptionInfo) at figwheel.main/nrepl-repl (main.cljc:1525).
Failed to launch Figwheel CLJS REPL: nREPL connection found but unable to load piggieback.
This is commonly caused by
 A) not providing piggieback as a dependency and/or
 B) not adding piggieback middleware into your nrepl middleware chain.
Please see the documentation for piggieback here 

Note: Cider will inject this config into your project.clj.
This can cause confusion when your are not using Cider.
I do have piggieback dependency in my “dev” profile in project.clj and :repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}

antonmos15:07:59

(ugh i meant to ask this question in #cursive and somehow failed 🙂 )