This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-28
Channels
- # announcements (1)
- # beginners (205)
- # calva (30)
- # cider (5)
- # cljdoc (25)
- # cljs-dev (2)
- # clojure (119)
- # clojure-brasil (5)
- # clojure-conj (7)
- # clojure-europe (2)
- # clojure-hamburg (7)
- # clojure-italy (14)
- # clojure-nl (2)
- # clojure-russia (13)
- # clojure-spec (79)
- # clojure-uk (58)
- # clojurescript (54)
- # core-logic (2)
- # core-matrix (2)
- # cursive (40)
- # datascript (2)
- # datomic (18)
- # duct (2)
- # emacs (14)
- # figwheel (3)
- # figwheel-main (7)
- # fulcro (30)
- # funcool (1)
- # graphql (10)
- # jobs (1)
- # juxt (13)
- # lumo (1)
- # mount (1)
- # off-topic (56)
- # other-languages (2)
- # pedestal (17)
- # powderkeg (2)
- # protorepl (2)
- # re-frame (10)
- # reagent (1)
- # reitit (7)
- # ring-swagger (10)
- # schema (2)
- # shadow-cljs (70)
- # spacemacs (13)
- # specter (4)
- # sql (9)
- # tools-deps (26)
I need to expose a function at the very top-level in a script. I.e., I need to generate something like,
var aFunction = function (params) {…
It’s for a tool that requires it. I don’t think it evaluates the file from top to bottom, it just goes and looks for that exact function in the file.I’m not sure how it’s actually doing it, but given a file where the function is just bog-standard exported, it just goes aFunction is not a function
.
Like, you can declare a top level function a few ways in JS. If it does have a to be a weird thing like that I’d just write a JS function wrapper.
The export thing puts the function inside the current namespace, so if it has to be a global thing, I’m not sure if it is possible.
Sorry, I meant write a .js file with the function as the tool expects it, and the function body just calls your exported CLJS function. You will need to figure out how to include both files of course.
I vaguely remember a figwheel conf (no idea if it’s a cljsbuild one) that allows you to prepend/append comments and code to your final build...
Perhaps? It will be a the top level of the file but I think JS will hoist the global Vars anyway so it should work?
If all else fails you could just append something to your final output out of band :)
I think I found the shadow-cljs equivalent. I set the target to be :node-library
, and added :exports-var silly-lib/aFunction
, and it sure seems to work.
has anyone been having trouble with Secretary (and dispatching) and the new cljs version?
Are you using https://github.com/clj-commons/secretary ?
@biscuitpants it has been forked and now maintained under clj-commons: https://github.com/clj-commons/secretary
File: ...
failed to require macro-ns "clojure.core.strint", it was required by "..."
FileNotFoundException: Could not locate clojure/core/strint__init.class or clojure/core/strint.clj on classpath.
I don't think it ever made it into clojure either
Does anybody know of a library for cljs to decompress LZ4? I know I could get this by including a npm dependency - is that feature still considered experimental?
@trailcapital If the LZ4 library you have in mind works via :npm-deps
, it should be fine to consume the library that way.
into-array
accepts an optional type argument for compatibility with clojure. But how does one call it in a way that’s compatible with clojure and clojurescript?
e.g. you need a reader conditional here, because JS doesn’t know what Integer/TYPE
is:
(->>
(into []
(map #(u/parse-int %))
(str/split-lines input))
(into-array #?(:clj Integer/TYPE)))
is there a way to check if a transient hash set has been persisted yet? i'd like to have an assert while i'm tracking down a bug but not sure how to check for that
ah i was thinking there was a flag that was set, ie, a transienthashset could be persisted but its type remained as transienthashset. thanks david
@dpsutton ah yeah, wouldn’t be functional with that kind of api, since that would mean banging on a flag in place
(deftype TransientHashMap [^:mutable ^boolean edit
this edit flag seems to be the flag i was worried about
it's what's causing me issues right now. i've got to track down why i have a persisted transient
whenever you see ^:mutable
on a deftype
knee jerk reaction should be “don’t touch that”