clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
Michael Rispoli 2020-10-10T01:02:31.379600Z

Oh the htmx is very cool. I think in my ideal world I was thinking something like this is a cool alternative. Reminds me of maybe like Phoenix live view or the old ruby unobtrusive js style.

Justin Chandler 2020-10-10T01:28:02.382800Z

Hey, everyone! I'm running into some inter-op troubles here. I have a function exported from a compiled clojurescript file that I'm trying to call in javascript, so I'm doing import { name.space.function as myfunc } from 'main.js', but it's giving me the error "expecting }" since it's not expecting the namespace .'s Is there a way to ^:export a function as a single keyword or some other way around this problem?

p-himik 2020-10-10T08:37:11.386300Z

When you ^:export something in CLJS, it becomes available as a global object, you don't need to import anything - you just have to make sure that the compiled CLJS bundle is loaded before that (well, I guess import could be used for that - but you would have to import the file itself and not the namespace).

p-himik 2020-10-10T08:40:45.386500Z

Just in case:

(ns a.b)

(def ^:export x 1)
should make window.a.b.x available in JS.

jacklombard 2020-10-10T08:09:47.384900Z

Hello, has anyone here used binaryage/chromex with shadow-cljs? I can’t get the repl to work, maybe I am doing something wrong. I am connected to the repl alright, but can’t seem to hot reload any code.

jacklombard 2020-10-10T08:22:17.385800Z

I think I got it working, never mind

jacklombard 2020-10-10T08:49:30.387700Z

Actually it works only for the pop-up and background but not the content script, is this expected?

Vincent Kowalsky 2020-10-10T11:51:12.390900Z

Hi, I'm using a javascript library that uses a single named export object with other functions as properties of that object. So now I have to use somehting like:

(ns app
  (:require ["lib" :refer [Layout]]))

(def Header (. Layout -Header))
I was just wondering if there is some destructuring syntax to bind Header directly in the :require?

p-himik 2020-10-10T17:44:57.391600Z

I don't think there's one. But you can make it a whopping 1 space shorter by replacing (. Layout -Header) with (.-Header Layout). :)

zilti 2020-10-10T18:10:12.392900Z

How would I go about having a macro inside a cljc file? I just added a #?(:cljs (:require-macros [my.namespace])) to my ns declaration, but that seems not enough

zilti 2020-10-10T18:33:00.393500Z

Ah, guess it does suffice. I just had to clear the temporary crap shadow-cljs and clj-deps create 🙂

Karol Wójcik 2020-10-10T21:17:56.394700Z

Is nubank/workspaces still active project?

Vincent Kowalsky 2020-10-10T23:39:53.395Z

Thanks, at least that's something I guess 😉