This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-11
Channels
- # beginners (79)
- # boot (21)
- # cider (28)
- # cljs-dev (1)
- # clojure (88)
- # clojure-italy (3)
- # clojure-russia (6)
- # clojurescript (49)
- # community-development (4)
- # cursive (37)
- # datomic (12)
- # editors (3)
- # emacs (33)
- # fulcro (15)
- # hoplon (9)
- # jobs-discuss (3)
- # keechma (3)
- # lein-figwheel (2)
- # luminus (3)
- # off-topic (146)
- # onyx (5)
- # portkey (11)
- # re-frame (34)
- # reagent (7)
- # reitit (5)
- # remote-jobs (1)
- # shadow-cljs (6)
- # unrepl (11)
what is amplify...?
https://github.com/aws/aws-amplify I’m guessing
A question related to :npm-deps
:
How do we refer the namespace as a whole
For instance, I’d lile to use regl
in my cljs project (http://regl.party/examples)
The js code looks like:
const regl = require('regl')()
// This clears the color buffer to black and the depth buffer to 1
regl.clear({
color: [0, 0, 0, 1],
depth: 1
})
How would you rewrite this js code in cljs?
@viebel (:require ["regl" :as regl])
in ns
, then (def regl-instance (regl))
, (.. regl-instance (clear #js { ... }))
I use some cljsjs packages in my leiningen cljs project. I want to use the css files of some packages, is there a leiningen equivalent to the boot sift command?
@sekao I am considering using paren-soup to permit users to edit a embedded cljs dsl in the browser. How would I best control/restrict namespaces and is accessing the 'textContent' of the editor div the best way to access the code in such a scenario?
@thheller I tried your code but I get an error. The code:
(ns regl.core
(:require ["regl" :refer [regl]]))
(enable-console-print!)
(println "Hello")
(regl)
The error:
Uncaught TypeError: module$Users$viebel$tutorials$regl$node_modules$regl$dist$regl.regl is not a function
trying it
@mfikes I get this error
Uncaught ReferenceError: require is not defined
Doing (module$Users$viebel$tutorials$regl$node_modules$regl$dist$regl)
would be a fragile hack
I’m looking for a repl for use with figwheel that gives me command history, autocomplete etc. (I’m also using cursive fwiw). Is Dirac my best bet?
you mention you're using Cursive...are command history and autocomplete not working for you? they work for me
@jrbrodie77 figwheel is going to have this by the end of the the coming week
I just deployed [lein-figwheel "0.5.15-SNAPSHOT"]
with added rebel-readline support. Be sure to launch figwheel with lein trampoline figwheel
and ditch rlwrap
!
@jrbrodie77 so actually you can start having the features you asked for right now
i’m looking forward to the day that clj
runs rebel-readline instead of rlwrap
, @bhauman 🙂 this is amazing work!
@thheller thx Still doesn’t work BTW, I’m in the browser and I’m using leiningen with lein-cljsbuild. My cljs code is:
(ns regl.core
(:require [regl :as regl]))
(enable-console-print!)
(println "Hello")
(def rrr (regl))
is transpiled to:
File Edit Options Buffers Tools Javascript Help
// Compiled by ClojureScript 1.9.946 {}
goog.provide('regl.core');
goog.require('cljs.core');
goog.require('module$Users$viebel$tutorials$regl$node_modules$regl$dist$regl');
cljs.core.enable_console_print_BANG_.call(null);
cljs.core.println.call(null,"Hello");
regl.core.rrr = module$Users$viebel$tutorials$regl$node_modules$regl$dist$regl();
//# sourceMappingURL=core.js.map
@viebel So now with that, you can't do this?
(.clear rrr #js {:color #js [0 0 0 1] :depth 1})
@mfikes No. I’m having this error in the browser
Uncaught TypeError: module$Users$viebel$tutorials$regl$node_modules$regl$dist$regl is not a function
what if you leave out the :as part?
I would try evaluating module$Users$viebel$tutorials$regl$node_modules$regl$dist$regl
in a REPL to see what it is 🙂
module$Users$viebel$tutorials$regl$node_modules$regl$dist$regl
is an empty js object
my hunch is that :as pointing to the same symbol as the thing itself is somehow shadowing
which is a bug in the ns macro implementation in clojurescript if so
Another hunch: The regl
loading code (which requires you to evaluate it as a function) makes for something that Closure can't grok.
@noisesmith same error with
(ns regl.core
(:require [regl :as koo]))
:thumbsup:
Something interesting: I’ve switche from :optimization :none to :optimization :whitespace and now I see a closure related error during compilation
SEVERE: /Users/viebel/tutorials/regl_tuto/resources/public/js/compiled/out/node_modules/regl/dist/regl.js:52: ERROR - Parse error. identifier is a reserved word
"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121};var int8=5120;var int16=5122;var int32=5124;var uint8=5121;var uint16=5123;var uint32=5125;var float=5126;var float32=5126;var glTypes={int8:int8,int16:int16,int32:int32,uint8:uint8,uint16:uint16,uint32:uint32,"float":float,float32:float32};var dynamic$1=35048;var stream=35040;var usageTypes={dynamic:dynamic$1,stream:stream,"static":35044};var arrayFlatten=flattenUtils.flatten;var arrayShape=
since :npm-deps
is pretty unreliable you may want to try shadow-cljs. made a quick regl demo https://github.com/thheller/regl-example
@mfikes doen’t mean that your guess was accurate?
@mac yes you read textContent to get the code from paren-soup. if you are using the instarepl feature you can pass a :compiler-fn option which runs every time the user edits something
@Bhauman thanks! I’ll try it out. Thanks for the tools, this stuff is super important. In my day job I work in jupyter/ipython and have seen it go from toy to very productive environment, so great to see cljs moving along too.
@joelsanchez when I run figwheel in cursive I don’t get a history and autocomplete
i start a lein repl from cursive and then execute "cljs-repl" (from the figwheel api)
that works flawlessly
I’ll try that. I’ve been doing lein figwheel in cursive.