This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-17
Channels
- # bangalore-clj (4)
- # beginners (60)
- # boot (63)
- # cider (2)
- # cljs-dev (22)
- # cljsrn (3)
- # clojars (32)
- # clojure (133)
- # clojure-gamedev (1)
- # clojure-germany (17)
- # clojure-italy (1)
- # clojure-russia (11)
- # clojure-serbia (16)
- # clojure-spec (35)
- # clojure-uk (75)
- # clojurebridge (1)
- # clojurescript (83)
- # community-development (25)
- # core-async (43)
- # cursive (15)
- # datomic (28)
- # emacs (2)
- # fulcro (108)
- # graphql (5)
- # hoplon (15)
- # lein-figwheel (6)
- # leiningen (39)
- # lumo (106)
- # new-channels (1)
- # off-topic (4)
- # om (26)
- # om-next (53)
- # onyx (46)
- # other-languages (2)
- # perun (1)
- # protorepl (5)
- # re-frame (13)
- # ring (18)
- # ring-swagger (1)
- # rum (6)
- # shadow-cljs (82)
- # spacemacs (19)
- # specter (5)
- # sql (3)
- # test-check (31)
- # unrepl (12)
- # untangled (2)
- # vim (109)
well, here's a minimal project based off of lein new re-frame
that adds react-bootstrap-typeahead
to :npm-deps
and requires react-bootstrap-typeahead
in the views.cljs file https://github.com/seako/react-bootstrap-typeahead-minimal-cljs-example
the two errors generated from this minimal example are:
tokenContainer.js:22 Uncaught TypeError: (0 , _reactOnclickoutside2$$module$Users$seako$dev$seako$github_repos$react_bootstrap_typeahead_minimal_cljs_example$node_modules$react_bootstrap_typeahead$lib$containers$tokenContainer.default) is not a function
at tokenContainer (tokenContainer.js:22)
at Token.react.js:31
tokenContainer @ tokenContainer.js:22
(anonymous) @ Token.react.js:31
typeaheadContainer.js:48 Uncaught TypeError: (0 , _reactOnclickoutside2$$module$Users$seako$dev$seako$github_repos$react_bootstrap_typeahead_minimal_cljs_example$node_modules$react_bootstrap_typeahead$lib$containers$typeaheadContainer.default) is not a function
at module$Users$seako$dev$seako$github_repos$react_bootstrap_typeahead_minimal_cljs_example$node_modules$react_bootstrap_typeahead$lib$containers$typeaheadContainer.default (typeaheadContainer.js:48)
at Typeahead.react.js:32
@U0CK4CKAP could you take a look at this? I'd love to be able to figure out a solution that works with the npm deps feature of the cljs compiler
in the javascript source of those two name spaces there are exports that look like:
export default tokenContainer(Token);
and
export default typeaheadContainer(Typeahead);
respectively@seako looks like react-bootstrap-typeahead
is not compatible with :npm-deps
. you can try using shadow-cljs
instead. lein new shadow-cljs thing +reagent
your announcement has a good sales pitch https://groups.google.com/forum/#!topic/clojurescript/oiXKTnJ2r9o now i'm even more intrigued
@seako https://github.com/thheller/react-bootstrap-typeahead-minimal-cljs-example did a quick test to verify that it actually works. 😉
I’m testing :npm-deps
here and would like to require application-insights: https://github.com/Microsoft/ApplicationInsights-JS#readme
However, I get the error: Uncaught Error: Undefined nameToPath for applicationinsights_js
@hkjels using figwheel from emacs/cider by any chance? What if you just lein clean && lein figwheel dev
in terminal?
did you include all the dependencies, including peerDependencies? Also confirm that it actually is inside your node_modules
if all else fails you're better of packaging it as a cljsjs. Which you'd probably have to do anyways for a production build.
what happens if you use clj->js
with some map that has javascript objects? not simple plain objects, ones that are called with new
does it leave those alone or does it end up doing something weird
@fbielejec I’ve tried a few different packages now with the same result. Why would you package as a cljsjs in prod? Is :npm-deps
just a toy?
@hkjels it's an experimental feature. From my experience in most cases it doesn't survive advanced optimization, even with externs. Are you on the most recent toolchain? (clojurescript compiler, figwheel cljsbuild etc)?
@risto If values, such objects pass through. You can see this if you do (source clj->js)
: Map values have cljs->js
applied to them, and you can see that the if/cond
will bottom out in an :else x
. On the other hand, if the objects are keys, then key->js
comes into play, and from its implementation you can see that they will be converted to strings via pr-str
.
The #js
tag can be used at compile time to create JavaScript object literals. If you already have a JavaScript object being produced at runtime via new
, then no need to consider #js
(it is actually too late at that point).
the use case I have is something like:
var Foo = function() { ... }
{ :foo { :bar (new Foo) } }
you're saying it won't right? because it's not a clojurescript type, it's not keyword?
,`symbol?`, map?
or coll?
so it hits :else
and is left unchanged right?
Right. For example (clj->js {:foo {:bar (new Uri "
yields #js {:foo #js {:bar #object[Object
By the way, instead of (new Foo)
you can write (Foo.)
. I think the latter is more prevalent.
No problem. If you (macroexpand '(Foo.))
, you will get back (new Foo)
. This will ultimately be covered in the official interop guide, I would expect; the draft has https://github.com/mobileink/clojurescript-site/blob/88805681e76a86dcab068ec8b574ed733ebd5f8c/content/reference/javascript-interop-ref.adoc#alternative-macro-syntax
is there a nice way to use http://socket.io with cljs?
Dearest cloojurescript family, For realtime serverside/clientside backend/frontend comms ... is sente still the gold standard? What do you guys like to use?
@bravilogy I don't know of a nice way to use http://socket.io with cljs, but there are a handful of libs/frameworks(?) that will make socket comms possible (and super fast) like Sente.
Hey! Recently I learned that people use expo (yes?) to make native android and iOS apps using clojurescript!
(so many questions, i'll pace myself.)
I tried sente but did it seemed more complicated that it should. I don’t mind there is no ajax as a back-up, so I just use a js websocket, and combined with a clojure-nginx websocket for the back-end it works great. But I did spend some lines getting it to reconnect etc.
@sova don’t know about expo, I know with cordova you you can make an app with just httml, css and js, so that should also work with js build by clojurescript
Thanks @gklijs I want to use the audio engine of the iOS ... and want to clojure...
Not sure how far you get with html5 in that case, I’m not an app developer myself, but are team does some api stuff for a team that does.
Yeah, looks like I gotta stay in Xcode if I want to make instruments:saxophone: on the iPhone
would love to do it in cljs though! ðŸ˜
i started a cordova project two years ago @gklijs - if i was to start the same project today i would probably start in react-native. two years ago react-native was mostly ios only, with an android beta and no windows or web support. today it covers all those platforms and i would go with react-native + reagent + re-frame
(and there is #cljsrn for react-native specific chat)
what are some general ideas/hypotheses I can try out when something doesn't work under :advanced compilation?
Alex Miller just cut core.async 0.3.465, this includes @juhoteperi macro enhancement
@vemv: is it an js accessor issue? rewrite using https://github.com/binaryage/cljs-oops
it's a React rendering issue, under certain circumstances a datepicker (https://github.com/cljsjs/packages/tree/master/react-dates) doesn't pop up
@vemv the first thing you do is to turn on the :pseudo-names
compiler option, plus :pretty-print true
https://clojurescript.org/reference/compiler-options#pseudo-names
That will give you more human-readable transpiled code.
@vemv this can either be caused by missing externs for javascript you add to the page besides the CLJS output