This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-05
Channels
- # aleph (190)
- # bangalore-clj (4)
- # beginners (31)
- # boot (127)
- # braid-chat (2)
- # cider (2)
- # cljs-dev (79)
- # cljsrn (7)
- # clojure (81)
- # clojure-dev (1)
- # clojure-greece (40)
- # clojure-italy (3)
- # clojure-korea (8)
- # clojure-new-zealand (5)
- # clojure-russia (5)
- # clojure-spec (87)
- # clojure-uk (13)
- # clojurescript (50)
- # cloverage (10)
- # component (4)
- # core-async (37)
- # cursive (26)
- # datascript (20)
- # datomic (29)
- # editors (2)
- # emacs (12)
- # hoplon (63)
- # jobs (2)
- # lein-figwheel (1)
- # leiningen (17)
- # liberator (2)
- # off-topic (19)
- # om (31)
- # onyx (9)
- # pedestal (4)
- # proton (1)
- # re-frame (22)
- # reagent (13)
- # ring (1)
- # ring-swagger (9)
- # spacemacs (5)
- # specter (4)
- # untangled (24)
- # vim (29)
Question: Is it typical to extend js/Object to implement ILookup to allow destructuring? When working with javascript react components it's typical for callbacks to be passed an object. Js now makes destructuring that convenient. Currently CLJS destructuring doesn't support jsobj.
Something like this does the job... I'm wondering if it's a bad idea or common practice.
(ns demo-ui.obj-lookup
"Extends js/Object to implement ILookup so we can destructure."
(:require [goog.object :as gobject]))
(extend-protocol ILookup
object
(-lookup
([o k] (gobject/get o k))
([o k not-found] (gobject/get o k not-found))))
Any ideas on how to dynamically change the meta data in reagent apps for to make it SEO friendly?
(set! (. js/document -title) title)
@rnandan273 that's how we set things which aren't part of the reagent views. Not sure that would help with SEO though.
Thanks @olivergeorge I will deploy the app and check out the results of the Google structured data tool results
@olivergeorge the problem with extending object
is that it applies to EVERYTHING since everything is an object
in js. not a problem but you may start seeing fuzzy behaviour with :advanced
optimizations
closure doesn't understand ILookup
and might even think you are not using the props and eliminate them
@deas: (.indexOf [1 2 3] 2)
should work with CLJS data structures
(lastIndexOf too)
@anmonteiro What does is use for the comparision? ISomthing?
ClojureScript equality
cljs.core/=
, which works with IEquiv
IEquiv, Thanks @anmonteiro !
@olivergeorge not typical and as @thheller notes not a good idea
Just wanted to thank the #hoplon, castra, javelin folks from Adzerk for some amazing tools. I just couldn’t be as productive without them.
hey folks, I'm using figwheel with re-frame for a web app, but changing the clojurescript's files do not cause figwheel to restart the server
Hi. Is anyone of you guys interested in converting JS back to ClojureScript (for different purposes)? If yes, please check out the project I've just started, which is intended to do that: https://github.com/andrewboltachev/muchjs
@andrewboltachev interesting, what use case are you imagining?
@dnolen like the one presented — say, I want to bring some snippets for some React libs to my CLJS project
Thanks. I'm not sure if I can use any JS React library in CLJS project, however. Many of them are ES6-heavy
Also IIRC Rich Hickey has once said, that "converting one language to another via Clojure" (or something) is a waste of time. So, may be this is the case. But rough conversion might like this be made possible, I think.
well generating equivalent code for typical mutable object oriented code isn’t going to be particularly fun - but there’s also the return on investment issue - if you can just consume this stuff anyway by some other means (JS Module processing in Closure) - then maybe the effort isn’t paying it’s own way
yep I agree, economical side of things is important. And yep, changing all the get/set style to functional one would be challenging, if not impossible (aka NP-complete). I want to see if and where this project would be helpful to me in actual use
Hi! did anyone managed to get cljs.spec.test/instrument working? I get an error requiring ns: No such namespace: clojure.test.check
@jetzajac just trying to guess: may be cljs.test.check
?
does cljs.reader on 1.9 not yet support the new namespaced keyword / map key syntax, f.e. #:foo{:bar #:bee{:baz 3}}
@andrewboltachev I'm trying to require cljs.spec.test, not clojure.test.check
ah... well I didn't actually try the Spec yet, so don't know
@jetzajac you need to explicitly require clojure.test.check
along with cljs.spec.test
in ClojureScript
@anmonteiro same error =(
@jetzajac do you have a dependency on test.check in your project?
@thheller @dnolen Thanks. That makes sense. It would be handy for destructuring to support native jsobj data. Has that been discussed/explored?