Fork me on GitHub
#clojurescript
<
2017-03-05
>
souenzzo04:03:22

Hey, how do I "`lein clean, cljsbuild once --SET_VAR=api-url=https://prod.site/api`"?? (something like command line env)

Jeremie Pelletier04:03:55

I’m trying to setup a dev environment for a service worker with boot-cljs but getting stuck on the :optimizations :none output file it generates as it contains document.write when I want it to use self.importScripts but I can’t find where to override that - writing a custom boostrap file loses the generated content such as defines which is cumbersome

Jeremie Pelletier04:03:01

i could use :simple optimizations but thats not ideal with reloading

luisdevlopez07:03:43

I have a question, should I use .- length "some string" or count "some string? Which one is better for performance?

gklijs07:03:52

interesting, running them in my own repl the difference is much less

rauh07:03:10

@luisdevlopez count will use .-length after a few if/else checks. So they'll be pretty much equivalent. Use what's more idiomatic: count

qqq09:03:02

I'm using CLJS to do WEBGL. My code works fine under :optimizations :none My code mungles some stuff under :optimiozatinos :advanced What confuses me is as follows: (. gl bindBuffer ...) <-- bindBuffer does NOT get mungled (. gl createVertexArray) <-- createVertexArray does get mungled what's going on?

darwin10:03:34

@qqq it is called "maybe-incomplete default externs coming from various random places in versions you can hardly control”: https://github.com/google/closure-compiler/blob/1f7d74b3c06c95c0264bc6722e6b1af17e08f7b4/externs/browser/webgl.js#L1885

qqq10:03:58

@darwin: yeah, I got externs working now and have been adding more in myself

darwin10:03:09

please note that there is no createVertexArray in that file

darwin10:03:20

only createVertexArrayOES

qqq10:03:25

it does exist in qqqgl.js 🙂

qqq10:03:55

I spent the last hour battling cljs/boot/externs

qqq10:03:20

next up: reading about signed distance fields, evaluating bezier curves on shaders, and firuging out why, in 2017, rendering text is still so annoying in webgl

qqq10:03:34

@darwin: I tried the aget, with strings, but I wasn't smart enough to figure out the .call part

qqq10:03:05

so with .call, it beomces

(.call (aget obj "field") obj arg1 arg2)
where obj has to be passed tiwce, the first to extract the field, and the second as the 'this' element ?

metametadata12:03:59

@souenzzo you can parametrise ClojureScript builds by using goog defines, e.g. take a look at https://clojurescript.org/reference/compiler-options#closure-defines

metametadata12:03:51

but I'm not sure if lein-cljsbuild allows to override compilation options like this in command line args, so in worst case you will need to create a different build id for each api-url and build that explicitly, e.g.: lein cljsbuild prod once

shakdwipeea14:03:15

Hi guys. I have just started learning clojurescript and started with a leningen template. The build was working initially , but now the figwheel repl is stuck and I see Please run lein figwheel to start the ClojureScript compiler and reload the page. message. Where should I look for errors?

hlolli14:03:42

@shakdwipeea most likely the browser has lost the socket connection to figwheel. Restart the figwheel and reload the browser.

shakdwipeea14:03:21

I have tried that multiple times. I tried to do lein clean but nothing helped.

hlolli14:03:08

that's weird, because if you're seeing that, you are running js code compiled with figwheel.

hlolli14:03:00

can you send me a link to the template you are trying to run?

shakdwipeea14:03:32

Also when I open in firefox I can see the working application with hot reloading but not when I refresh.

shakdwipeea14:03:01

The template was working initially. I changed some code, I will try to post a github link.

hlolli14:03:04

that could be because you hot reload to localhost:3449/uri-that-doesnt-exist-in-the-handler then reload and you see blank page. (just a theory)

shakdwipeea14:03:41

I think that could be the reason, let me check.

pesterhazy14:03:59

often browser caching causes these issues

pesterhazy14:03:04

try a different browser altogether

shakdwipeea15:03:36

yes I think it is , because on chromium Ctrl + R seems to solve the problem

shakdwipeea15:03:30

Ok i think I got it, it was a combination of both what you guys said, a rogue handler was not running on hot reload change and I think due to browser caching I was unable to debug them

shakdwipeea15:03:27

It is now working on chromium and firefox but not on opera

shakdwipeea15:03:10

I think that is mostly due to some caching issue ..

shakdwipeea15:03:15

Thanks a lot guys

darwin15:03:59

@qqq yes, .call usage is quite verbose, but you write a wrapper function once, and then use it conveniently, or via cljs-oops simply (ocall obj “field” arg1 arg2), it passes correct this to .call for you

eveko19:03:05

Would it be a good idea to use clojurescript and reagent as a frontend for a java ee application?

emccue20:03:27

Sure, why not

emccue20:03:32

Java EE is just your back end, it provides an API which the frontend (regardless of the technology it is written in) can take advantage of

emccue20:03:20

React (and by extension reagent) is just a system to help in making the UI, it doesn't matter what your back end is

emccue20:03:56

It starts to matter if you go full tilt and want to make an spa, since certain tools make server side rendering more manageable

emccue20:03:13

But server side rendering is optional, so it depends on your needs

emccue20:03:36

I might be able to give better advice if you could share more about your application structure

emccue20:03:50

Existing or intended

eveko22:03:55

So this is part of a school assignment. The course for this semester is Java EE. For this quartille we will make a simplistic twitter clone. The first part of this assignment is to build the back end, this is done with java ee api. What most of my class does is setup paraya/glassfish with a mysql database both on the local machine(I do it on my remote server). How it is expected of us to make this work is with a servlet that calls a service that calls a dao implementation. After the back end is done we get to the front end. School will use Angular as course material but we are encouraged to try something different so long we can explain the design pattern used. Important thing to note is that schools has us setup jenkins and artifactory as part of a CI/CD pipeline, though I think it should not be a problem to add Lein CLJS build as part of the jenkins build configuration.