Fork me on GitHub
Justin Chandler01:10:02

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 { 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?


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).


Just in case:

(ns a.b)

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


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.


I think I got it working, never mind


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

Vincent Kowalsky11:10:12

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?


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

Vincent Kowalsky23:10:53

Thanks, at least that's something I guess 😉


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


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

Karol Wójcik21:10:56

Is nubank/workspaces still active project?