This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-22
Channels
- # aws (4)
- # bangalore-clj (2)
- # beginners (99)
- # boot (8)
- # clojars (22)
- # clojure (87)
- # clojure-dev (2)
- # clojure-greece (10)
- # clojure-russia (22)
- # clojurescript (80)
- # cursive (4)
- # data-science (2)
- # datomic (10)
- # emacs (1)
- # fulcro (1)
- # garden (2)
- # luminus (1)
- # lumo (29)
- # off-topic (20)
- # om (6)
- # onyx (18)
- # parinfer (7)
- # perun (1)
- # portkey (28)
- # re-frame (93)
- # reagent (59)
- # ring-swagger (2)
- # shadow-cljs (31)
- # slack-help (15)
- # spacemacs (5)
- # uncomplicate (3)
- # yada (6)
I think I should be more specific about the source:
world.js
:
require('chromedriver')
var seleniumWebdriver = require('selenium-webdriver');
var {defineSupportCode} = require('cucumber');
function CustomWorld() {
this.driver = new seleniumWebdriver.Builder()
.forBrowser('chrome')
.build();
}
defineSupportCode(function({setWorldConstructor}) {
setWorldConstructor(CustomWorld)
})
what would that be in cljs
?it seems like the destructured setWorldConstructor
might be a big challenging to recreate in cljs
here's what I have so far:
(js/require "chromedriver")
(def seleniumWebdriver (js/require "selenium-webdriver"))
(def defineSupportCode (.-defineSupportCode (js/require "cucumber")))
(defn custom-world []
(this-as this
(let [builder (new (.-Builder seleniumWebdriver))
forBrowser (.forBrowser builder "chrome")]
(set! (.-driver this) (.build forBrowser)))))
I tried:
(defineSupportCode (#(% (% custom-world)) (.-setWorldConstructor (js/require "cucumber"))))
but ended up with:
Cannot set property 'World' of undefined
in this case, setWorldConstructor
is a function in cucumber
that modified this.options.World
I feel like this is also pretty close:
(defineSupportCode #((.-setWorldConstructor cucumber)))
Cannot set property 'World' of undefined
I also tried something like this:
(defineSupportCode
(fn [ref]
(let [setWorldConstructor (.-setWorldConstructor ref)]
(setWorldConstructor custom-world))))
same error thoughI'm thinking maybe I need to use this-as
here too somewhere
not sure where to inject it though
I think ☝️ is equivalent to this:
(defineSupportCode
#(% ((.-setWorldConstructor %) custom-world)))
same error still
Hi, how to use nth-child
pseudo-class in garden
? I found it need a extra n
parameter but don't know how to write it after :&:
. I tried :&:nth-child(4)
and :&:(nth-child 4)
, both failed.
@ajs cljs.core/*assert*
is really for self-hosted ClojureScript. In JVM-based ClojureScript, clojure.core/*assert*
is used during compilation. In other words, if you macroexpand assert
, in JVM ClojureScript, you are using clojure.core/*assert*
, while in self-hosted, you are using cljs.core/*assert*
. A consequence is that if you print *assert*
you are simply seeing the value of cljs.core/*assert*
. A little more elaboration on the self-hosted aspects of *assert*
are at http://blog.fikesfarm.com/posts/2016-05-08-bootstrap-asserts.html
Thanks Mike. I was mainly interested in which *assert*
to look at when writing a macro that should have different behavior when :elide-asserts is true. It became clear how to proceed after a bit of playing.
What is the correct way in CLJS to implement .then
and .catch
methods of a JS Promise object?
I have code like the following which seems to work perfectly, but triggers a warning in my builds:
(defn sign-out []
(-> (js/firebase.auth)
(.signOut)
(.catch (core/default-error-handler))))
WARNING - Keywords and reserved words are not allowed as unquoted property names in older versions
of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option.
return firebase.auth().signOut().catch(com.degel.re_frame_firebase.core.default_error_handler());
^
@deg, https://github.com/emezeske/lein-cljsbuild/blob/master/sample.project.clj#L89
Yup, figured that out. (Sorry, didn't answer with the solution 'cuz I'm still working out the details. My case is a bit twisted with a Mies-based library being used by a cljsbuild'd project. Plus, family interruptions. ... embarrassed grin ...
@abs-zero - what's the context around that? It sounds like you need to run "lein figwheel" from the cmdline if that's your env or start it from Cider if you are in emacs or ...
just a new project, beginner here I restarted figwheel then it finally showed error on console I fixed it now thanks anyway
ok. good luck. Sadly, restarting things or even a lein clean
are helpful way more often than we'd like.
ok I intentionally made an error on the program but figwheel isn't printing any error
Ah, I've seen that sometimes working in an Emacs/cider environment. I've never looked at it carefully, but seems to happen when one file was changed since the last time Figwheel checked but the problem was in another file.
this has happened to me plenty of times nothing is printed by figwheel on console when I make changes on file
Figwheel echos errors to a popup in your browser. I don't know if it also prints to console.
@abs-zero difficult to diagnose remotely without knowing more
here's a checklist of things to try 😉 https://gist.github.com/pesterhazy/a53dc9759f11497e54ea04137e3cbb5f
If I'm really lost with a problem, I'll start with an empty template, make sure it works, then add back my code bit by bit.
It's annoying but sometimes the only way to uncover what usually turn out to be misconceptions on my part
check figwheel_server.log
It should contain a compiler error. The same should also be shown in the terminal if you restart the repl
I've added it to the checklist above 🙂
okay isn't there a fix to this? is this a bug? it would suck if I had to check log everytime 😕
The cljs code is basically too screwed up to compile, so it's not clear what figwheel should show
It's just a habit you acquire to check the terminal log.
I agree it's not ideal UX wise though - you need to check for errrors in multiple places
@dimovich i.e. the issue is probably not in the snippet you showed
@dnolen @pesterhazy checking now... this started after adding a modified cljsjs module
watch out for any instances of js interop, (.method obj)
or (.-property obj)
can someone advice a set of tools to build isomorphic clojurescript app?
Which engine to use on server side?
Which router to use?
Can anyone comment on the differences between cljs-devtools and Dirac? Same author and both are billed as tools on top of Chrome DevTools. Having some difficulty understanding the differences in abstraction/application of these two libraries.
@ajs if you use clj-devtools
, any ClojureScript data structures you write (eg. println
) to the js console will appear as EDN rather than js
. This is a massive help. A can't-live-without-it kind of help.
Dirac
is a further step which actually gives you a ClojureScript REPL in DevTools. An alternative "console" to the regular js one.
i assume then that the functionality does not overlap between the two, they are complementary?