This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-18
Channels
- # aleph (1)
- # announcements (2)
- # aws (4)
- # beginners (73)
- # boot (2)
- # boot-dev (3)
- # cider (6)
- # cljs-dev (40)
- # clojure (64)
- # clojure-austin (2)
- # clojure-belgium (1)
- # clojure-dev (25)
- # clojure-estonia (1)
- # clojure-europe (16)
- # clojure-italy (11)
- # clojure-nl (4)
- # clojure-spec (90)
- # clojure-sweden (2)
- # clojure-uk (105)
- # clojurescript (58)
- # core-async (10)
- # cursive (23)
- # data-science (1)
- # datascript (3)
- # datomic (14)
- # duct (11)
- # fulcro (48)
- # graphql (1)
- # hyperfiddle (3)
- # kaocha (95)
- # liberator (1)
- # lumo (6)
- # nrepl (1)
- # off-topic (14)
- # onyx (2)
- # overtone (8)
- # portkey (3)
- # re-frame (31)
- # reagent (6)
- # shadow-cljs (185)
- # sql (12)
- # tools-deps (6)
- # vim (6)
- # yada (224)
Is there a good tutorial for using spec in ClojureScript?
I'm trying to use it in a Reagent/Figwheel/Expo application and would like to see some examples of other uses.
@kinnes In general, the ClojureScript implementation of Spec adheres very closely to that of Clojure, so any Clojure tutorial should apply as well.
Okay, cool -- is https://clojure.org/guides/spec sort of the best source of truth for how to use it?
before i bother filing a bug…is it a known issue that protocol method names cannot clash with javascript reserved words like delete
? it’s understandable that it doesn’t work but the error only happens when you try calling the method, and all it says is Cannot read property 'object' of undefined
. no me gusta.
@sekao I don't recall a JIRA like that. I tried, but can't repro: https://gist.github.com/mfikes/f8f1367bc55842a2c7fe4a08d0231c7b
Hrm.
cljs.user=> (extend-type default IFoo (delete [_] 1))
nil
cljs.user=> (delete #js {})
1
are you sure that isn’t a behavior difference with whatever repl you’re using? here’s what my file looks like:
Ahh... oops. For that last test I was using something off either master or a patch... I can repro with 1.10.439
. So there's hope. 🙂 Let me see if things works master.
Interestingly, the fix was evidently a side effect of this patch (according to git bisect): https://github.com/clojure/clojurescript/commit/23ab9a095599446e3c2aa5013d2b8edf2bbe467f
most likely related to this https://dev.clojure.org/jira/browse/CLJS-2983
Adding a test for that case with https://dev.clojure.org/jira/browse/CLJS-3039
There was some discussion about #reitit yesterday - I updated the example reagent app to use clojure.spec coercion instead of schema, found here: https://github.com/metosin/reitit/blob/master/examples/frontend/src/frontend/core.cljs. The example also has the documented how to switch to use HistoryAPI. For backend... reitit has built-in modules for ring, pedestal and sieppari. It could be used with #yada too, but the coercion is part of the endpoint data model, which overlaps with yada resources, so the spec coercion with yada would need some extra integration to work.
I wonder if there is a way to limit the amount of dates available in reagent-forms datepicker? Use case: date range selection, one should not be able to select end date which is before the start date. I can of course prevent this via checking the selected value afterwards but it would be more user friendly if those dates were not selectable in the first place. Can't see a way to do this, ideas?
hello, I'm going insane trying to get atom (proto repl) + lein-figwheel or figheel-main working, are there any guides for this? I've tried all I could find by googling
It's a hot mess right now. Save yourself the headaches and check out shadow-cljs
I was happy that atom seemed like a good editor to recommend to newcomers, but not being able to develop clojurescript is kind of bad 😞
@saikyun for some things you would probably be faster with a REPL but the feedback loop of instant reloads is so quick that in many situations it's not much different than using a REPL. Also consider that you might often work on something more visual that would be hard to inspect in a REPL as well.
@saikyun not really. I sometimes def something so I can inspect in in the browser console with cljs-dev-tools
With cljs-devtools it's nicer than in a REPL (for plain "looking at things" at least)
It only works in Chrome I'm afraid
@saikyun no. but you can also do [:pre (with-out-str (clojure.pprint/pprint the-map))]
if you’re using reagent
Yeah, I just use atom with a console repl. Hot reload on save and then do any repling stuff I want to in the console.
Would anyone know how I achieve modules.export
with clojurescript?
// tools.js
// ========
module.exports = {
foo: function () {
// whatever
},
bar: function () {
// whatever
}
};
var zemba = function () {
}
Essentially I have a function that I am exporting in clojurescript
(defn ^:export add-numbers [a b]
(+ a b))
And I'd like to wrap it with modules.exports
@jacobhaag17 some build tools handle this for you. what build tool are you using?
Yup, I am using node.js as my environment
Essentially I want to access an exported function in another js file
leiningen and cljsbuild
https://github.com/bhauman/lein-figwheel/wiki/Node.js-development-with-figwheel#common
Cooleo, thanks much @lilactown
Hi, I am building a full stack web app and currently using lein and cljsbuild for compilation. (Based on reframe lein template.) I am thinking of switching to shadowcljs for npm support. What is the workflow for web server compilation, to produce uberjar?
@pavel.klavik check #shadow-cljs
does anyone have any pointers to deploying ClojureScript libraries to clojars with tools.deps? I did clojure -Spom
and mvn deploy
, but it only put an ~empty jar in clojars (no sources)
there are some packaging/deployment tools in https://github.com/clojure/tools.deps.alpha/wiki/Tools although they are mostly oriented toward clojure code, not sure if they will do what you need for cljs
yeah, I was looking at pack, but honestly I don't even know what it takes to publish a cljs package to clojars 😕 always used lein in the past, and now I know nothing of what it really did
looks like I can generate a pom and jar, and then try mvn deploy. I'll tinker around a little 🙂