Fork me on GitHub

is anyone here pretty familiar with core.logic?


i'm trying to figure out what's making appendo terminate, from the looks of it, it seems like it should just be infinite like anyo


there's a #core-logic channel that might be more helpful


tools.cli has supported ClojureScript for quite a while but it has done so through a separate .cljs codebase. I'm considering moving to .cljc and dropping support for Clojure 1.6 and earlier -- which doesn't seem controversial. I have a question about *assert* tho' -- in the cljs version of the codebase, tools.cli unconditionally performs some debug-level checks on argument spec formats. In the clj version of the codebase, it has (when *assert* ...) around those checks. Having read the differences between cljs and clj, I'm not clear whether that form -- (when *assert* ...) -- is appropriate or not. Input?


The other difference in the tools.cli codebase is that clojure.pprint seems to be replaced by goog.string.format in the cljs version -- is that still a fair assumption?


Also, since it's been a long time since I last used cljs, what's the current best practice around catch with js/Error vs Throwable? It it still to use reader conditionals or is there something simpler?


hmm tried to use aws-amplify for some logins and ran into this problem with :npm-deps


looks like I should manually build & include the deps instead because of this feature


benzap thanks


@seancorfield Uaing *assert* should be OK. When set to false in ClojureScript, (when *assert* ...) should expand to nil which should be further completely elided when it is a "statement" (as inside a do). Probably worth checking. There is a cljs.pprint in ClojureScript now. But, it causes some code size issues. So does goog.string.format. But perhaps this is not so much an issue for CLI programs? With respect to catching, typically code does something like #?(:clj Throwable :cljs :default) (At least until is done and widely deployed.)


is there anybody using "collapse" option of bootstrap ?


within clojurescript


Hi guys best way to get started with ClojureScript and re-frame fast? 😅


Thanks 😉


@mfikes Much appreciated! I'll look at cljs.pprint to see if I can have a single code base with almost no conditionals 🙂


Hi. I'm trying to add a script element in my cljs file. The element is getting in there; I can see it in my inspector, but the script is not running. How can I get the script to run?


Here is the code I tried:


[:script {:type "text/javascript"} "jQuery(document).ready(function($) {\"alert('hello')\"})"]


Here is the output it produced:


<script type="text/javascript">jQuery(document).ready(function($) {"alert('hello')"})</script>


When I had done just the alert without the surrounding jQuery.ready, the alert never alerted.


It sounds like you did get the script to run?


I got the script tag to appear in the HTML, but not the alert to run.


But I'm passed that now. I've got some bizarre error that: Objects are not valid as a React child


I have [:div {:id "myGrid" :style {:height "1000px"}}] (let [the-head js/document.head the-script (.createElement js/document "script" ) the-script-value "alert(\"The script was run\");" ] ; if you need to load a js file (set! (.-type the-script) "text/javascript") (set! (.-src the-script) "js/my-grid.js") (set! (.-innerHTML the-script) the-script-value) (.appendChild the-head the-script) ) And my error is: SlickGrid requires a valid container, #myGrid does not exist in the DOM.


Try this:

(defn load [aname url]
  (let [tag (.createElement js/document "script")]
    (set! (.-id tag) (str aname))
    (set! (.-src tag) url)
    (let [first-script-tag (first (array-seq (.querySelectorAll js/document "script")))]
      (.insertBefore (.-parentNode first-script-tag) tag first-script-tag))))


well, that's more for pulling in external js. But it works.


Is there any performance benefit when using transdusers in cljs. I know that in clj one avoids creating intermidiate objects.


@its.ramzi oh, my bad. It looks like your script is running. But maybe it's running before react has a chance to populate the dom


@john It's amazing, calling one line causing my whole page to crash. Without calling your load function, my whole page loads except the table. Calling the load function, only the table loads and none of the page does


Don't pass in the myGrid as the aname parameter. Just give it a unique name that won't collide with anything else in the dom.


I am thinking to make a basic replica of this project to put on github for you to take a look at


hmm, maybe the function I provided doesn't play nice in a react lifecycle? React is a complex beast.


You'll probably want to stick your grid lib loading logic in a "componentDidMount" handler somewhere, depending on what react lib your using. It's a non-trivial topic and takes some study to understand.


@clojurians-slack this seemed to actually be the issue with the UIkit components as well last time


resolved via componentDidMount (allegedly idiomatic) or emitting events in react


mmmm makes sense


@john I stripped my program down to the bare bones. I have the app rendering server side. Can you get it rendering client side?


If you can get a minimal repro up on github, there's a good chance you'll be able to get some feedback on here

Mario C.22:09:49

I upgraded cljs-ajax and it causes my POST requests to break.

Mario C.22:09:27

The way my POST were structured was like

(POST "/exec"
{:format :json
:params {:body (js/JSON.stringify (cljs->js params))}
:error-handler (error)
:handler (fn [r] (put! ch r))

Mario C.16:09:54

In case anyone is curious, the solution was {:format :url ...}

Mario C.22:09:39

Does anyone know what I am missing to get it working with version 0.7.3?

Mario C.22:09:50

I tried looking at the docs and they weren't helpful

Mario C.22:09:30

In the previous version we were using, 0.1.3 I noticed that the payload was being sent as Form Data

Mario C.22:09:42

Now it is a Request Payload


Would folks be interested in a mini static cljs blog that could update itself from a self hosted repl in the browser?


I've got one half way built, able to push commits. But why aren't self updating static blog sites more popular? Are people worried about security or something?

Dustin Getz00:09:31

i would love to see what you’ve got


Cool. I think once I've got it up on github, it should just be forkable, with maybe a little customization.


Maybe 100% in-browser though