This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-24
Channels
- # announcements (1)
- # aws (2)
- # beginners (147)
- # boot (19)
- # cider (57)
- # clara (52)
- # cljdoc (18)
- # cljs-dev (14)
- # cljsrn (4)
- # clojure (176)
- # clojure-conj (9)
- # clojure-dev (9)
- # clojure-germany (2)
- # clojure-italy (4)
- # clojure-spec (13)
- # clojure-uk (56)
- # clojurescript (72)
- # code-reviews (11)
- # cursive (17)
- # data-science (1)
- # datomic (52)
- # duct (26)
- # emacs (6)
- # events (9)
- # figwheel (1)
- # figwheel-main (21)
- # fulcro (132)
- # funcool (1)
- # graphql (3)
- # jobs-discuss (42)
- # leiningen (3)
- # luminus (45)
- # mount (10)
- # off-topic (2)
- # re-frame (17)
- # reagent (12)
- # reitit (20)
- # ring-swagger (7)
- # rum (3)
- # shadow-cljs (256)
- # slack-help (15)
- # sql (7)
- # tools-deps (50)
- # uncomplicate (1)
- # yada (9)
Hello all, I´m trying to use clojure.string/upper-case
and I´m getting this s.toUpperCase is not a function
$ planck
ClojureScript 1.10.339
cljs.user=> (clojure.string/upper-case "foo")
"FOO"
I get that error with non-strings fed to the function though.Does cljs have a separate 'safer' EDN reader the way Clojure/Java does? Sorry I'm only echoing your question with slightly more detail. Clojure/Java has a code-reader that can do arbitrary side effects, and a safe EDN reader that cannot.
If tools.reader has a cljs version in a namespace with edn
as part of the name, I would recommend that one if you don't need something more powerful.
And, as Andy recommends, the docstring for cljs.tools.reader/read-string
includes the sentence:
To read data structures only, use clojure.tools.reader.edn/read-string
(Writing a quick JIRA to have the proper namespace in that docstring.)Is there an alternative to Throwable->map
in ClojureScript?
@richiardiandrea perhaps cljs.stacktrace/parse-stacktrace
or other fns in that namespace might be useful
Do you think it should be added for feature parity with Clojure?
The statk trace is custom but maybe message and stack trace string could go in a map
I am trying to use Material-UI within Reagent. I found cljsjs/material-ui which seems to be the most recently updated library, but I cannot find any example. Is anyone using Material-UI in reagent apps?
hi, anyone knows about the :global-exports
option. I have added [cljsjs/react "16.4.1-0"]
to project.clj and tried the below code. But it throws error that cljsjs.react/createElement var not defined. I checked in the jar file in m2. It had a deps.clj which has the proper declarations for :foreign-libs
including :global-exports
. Am I missing something?
@pradyumna not sure but I think you must use react
instead of cljsjs.react
in the require
@hoertlehner an example of MaterialUI. basically, you need to adapt the component classes like Input, Button. then you can pass the almost most property by specifying simply in the map. Just careful with special values type Object
, there you should pass a js-object not a clojure map.
Hi. Inspired by Stuart Halloway's latest talk, I have released a live coding tool I have used for some while in my hobby projects. https://github.com/witek/bindscript
Now I would like to leave my "bindscripts" in my source files. But disable them in production. Since def-bindscript
is a macro, it should be possible to emit nothing for production. But how does the macro check, if it is a production build? Thanks for a hint!
the better way is to put them behind a Google Closure define - then you can use that same code for dev / prod builds and Closure can DCE that stuff based on some flag of your choosing
How good is Figwheels hot reload compared to JS https://webpack.js.org/concepts/hot-module-replacement/? I didn't really find any good posts on the internet..
Probably as good as you don’t need to you anything from JS to do FE development in ClojureScript.
I read a post that said that it existed in CLJS before JS.
That’s possible, I didn’t read it.
after including this when I try to run 'lein doo phantom test', our tests are failing with "ReferenceError: Can't find variable: module"
@dsuren :npm-deps
should be considered an experimental / advanced feature, which requires expertise and a decent amount of effort to sort through problems
In other words, if you're up for it, I would recommend start digging through where the train left the tracks
For something like this I'd try to find the code in the output directory that seems to be defining module
An alternative is to not use :npm-deps
and use something like https://clojurescript.org/guides/webpack
sure... I was searching all over in src code. never thought of looking into output folder 😛
Yeah, you will see that Google Closure rewrites stuff and then the rewritten code is loaded. Sometimes the issue is in Closure, sometimes it is something that can be tweaked in the library, and sometimes it is a defect in ClojureScript.
@coderdanger CLJS is probably better in the hot-reloading department, largely due to the Lispy-ness of Clojure
@dsuren also a good question is whether what you have already assessed the webpack support
I am trying NPM dependencies (`:npm-deps`/`:install-deps`), but the deps are only downloaded when I cljsbuild
, not on lein deps
. Is there any way I can force the dependencies to be downloaded?
so much less likely to get stuck on something that even a ClojureScript compiler dev can't explain quickly
Has somebody tried out using web assembly with clojurescript yet? Webpack 4 supports it, but not sure it would be the easiest way.
it feels more like ClojureWASM is another top-level target, like ClojureCLR, with only a passing relationship to the ClojureScript world.
maybe borrowing some of the JS interop syntax.
@gklijs you can interface with wasm modules with the usual js interop in cljs
@shaunlebron but how to load them, npm-deps or shadow-cljs? Maybe it's simpler, I did some js interop with cljs, but not with libraries.
@gklijs just looked into how to load them in js, and it’s a bit of a mess right now with manual compilation of each .wasm file when loading
but it looks like they’re planning to make loading wasm modules as easy as loading ecmascript modules, via <script type="module" src="foo.wasm">
or import "./foo.wasm"
early stuff though: https://github.com/WebAssembly/proposals/issues/12
my guess is that shadow-cljs might add a custom loader if you ask for one
but cljs core will probably wait for google closure compiler to do it (probably after the linked proposal is settled)
in the meantime—you’ll have to load them manually yourself: https://webassembly.org/getting-started/js-api/
Doing it like that would be great. I will try out shadow-cljs soon. Even with webpack it's not all working great yet, even with just typescript and a wasm module I could not get a production build working easily.
@gklijs => #shadow-cljs
Any chance anyone here has an example of a functioning ClojureScript/Electron/Figwheel-Main application? I've run up to a block where exposing electron
to the global context (`window.Electron = Electron;`) doesn't work for the main electron process since window isn't available