Fork me on GitHub
#clojurescript
<
2016-03-30
>
fasiha00:03:45

I'm looking at http-kit's websocket example at http://www.http-kit.org/channel.html#websocket, which shows how one puts one request handler inside a http-kit with-channel macro, and in the macro's body one interacts with the channel. This channel is an http-kit channel and not a core.async channel, interestingly enough. My question is, doesn't this architecture prevent me from sending websocket data to the client from outside the request handler? I.e., if I have a plain REST API or something else happens in my Clojure app, and I want to send it to the websocket, there doesn't seem to be a way to access the channel.

josh.freckleton00:03:24

is there a library, or best practice for storing things in the browser's localStorage?

fasiha00:03:17

@bhauman: a watched atom—brilliant. Thank you!

jvtrigueros02:03:04

I'm trying to create a watcher for this HTML watcher example https://github.com/bhauman/lein-figwheel/wiki/HTML-watcher-including-browser-reloading. It all works out, but I have a question: is there a way that figwheel.client can trigger a call to :on-jsload instead of doing a (.reload ...)?

zcaudate05:03:48

hey guys, I’m looking for a cljs dev (game development experience a plus) for a reagent based ux project. We're a startup based in China and so initially it’ll be remote/project based work. Please ping me if you’re interested (<mailto:[email protected]|[email protected]>) with your resume and previous creations.

tord07:03:38

@zcaudate: Have you tried the #C05006WDW channel? I think you'd have a better chance of success there.

zcaudate07:03:16

wow… 3 positions got put up just today

jennifermorgan200111:03:38

Hi, does anyone know of a sample Om.next <-> datascript <-> datomic example I could study?

cjmurphy12:03:14

@jennifermorgan2001: You could go to #C06DT2YSY and/or #C0PULSD25 channels. There are examples - for instance in Untangled there's something like that (there's a ToDoMVC application), but its short the datascript part. I'll look it up...

cjmurphy12:03:41

I think you would be on your own a bit if you wanted to use Datascript - Untangled is with the default database format.

dnolen13:03:00

I probably missed it did @mfikes already make a demo with this? https://github.com/ptmt/react-native-desktop simple_smile

anmonteiro13:03:59

I think there was also a video

anmonteiro13:03:04

I can dig it up if you're interested

dnolen13:03:53

ah right! Now I remember - seems like there’s a lot of interest in RN OS X today.

anmonteiro13:03:22

I think that repo you linked was in the front page of HN today

anmonteiro13:03:56

but I suppose it's a few months old already

isak15:03:56

anyone using the file-system-watcher in figwheel-sidecar for dev tooling? o

isak15:03:39

i added a file-system-watcher for a less directory, and it is kicking off a rebuild of the clojurescript also for some reason

bhauman16:03:04

@isak: that really shouldn't happen, the only explanation is that you less path or less output path is on a directory path that is watched by figwheel.

isak16:03:05

ah right, i had src/less, i will change that. thanks!

bhauman16:03:20

@jvtrigueros: you can call the same function that on-jsload is calling.

hlolli18:03:04

Is there any way to port cljs app into nw.js desktop app (or similar technology offering native-ish app programming with clojurescript).

darwin18:03:15

@hlolli: the answer is probably yes, but your question should be more specific. what kind of cljs app? nw.js or electron are wrapping browser technologies so porting a standard web app there should be quite easy.

hlolli18:03:51

Well yes, I kinda asked without doing much research on this topic. Porting a standard web app yes, without the user needing to install much himself, npm package for example, just requireing nodejs. I've read that LightTable is hosted on chromium, is that correct? Because that could offer a possibility of using nacl offered by google chrome.

darwin19:03:34

last time I checked LT it was using nw.js, but they had a branch with electron as well

darwin19:03:07

AFAIK, node is bundled in electron itself, so user does not need to install anything extra

darwin19:03:17

assuming you don’t need to compile native modules

hlolli19:03:57

Allright, I guess it should work then using nw.js with cljs. Would LT work without java installed (only install LT with java preinstalled).

darwin19:03:12

there is no problem using cljs with nw.js or electron, cljs can do anything javascript can and cljs transpilation is transparent to the underlying platform

darwin19:03:48

LT itself does not require java, but some LT plugins might

darwin19:03:00

just checked out this folder and it looks that LT is using electron these days: https://github.com/LightTable/LightTable/tree/master/deploy

hlolli19:03:49

Ok, LightTable is wonderfully easy to install, so I will look into electron. Well, my mind has changed after reading this: http://tangiblejs.com/posts/nw-js-and-electron-compared-2016-edition NW.js supports NACL and pepper.

dhruv119:03:54

question: I am trying to use an external javascript library in my clojurescript project. https://github.com/jxnblk/watch I have no idea how to use it though. Can anyone point me in the right direction

hlolli19:03:42

Are you using leiningen or boot?

dhruv119:03:04

thanks! having a read.

hlolli19:03:28

Otherwise you would just add an :externs to cljsbuild in profiles.clj I don't see the use of creating a seperate build.clj file like is suggested in this manual.

dhruv119:03:37

i was also using lein-npm plugin and browserify to package it all in one file

dhruv119:03:44

but didn’t have any luck with that.

ag21:03:47

rlwrap for lein repl and lein figwheel seem to be acting differently, when in figwheel I can’t repeat last command with up-arrow key. Someone help? upd: seem to be this https://github.com/bhauman/lein-figwheel/issues/228 using socat helped

sd21:03:25

hi all, I'm trying to make a post request with cljs-ajax

sd21:03:22

but the payload isn't what i was expecting - it looks like ["^ ","~:username","hello","~:password","123"]

sd21:03:03

any ideas?

nullptr21:03:40

looks like you're sending transit (request content-type should confirm that), probably have to tweak a param to get pure json

sd21:03:41

ah, thanks, i should've been using :format not :response-format

sd21:03:53

i might not even need it

richiardiandrea21:03:18

random thought, sometimes I wish there was a "backward" comment:

this is a comment ;;<        fs-n1 (hl-n1 fs-n0)] <- this is still valid code

nullptr21:03:02

(comment this is a comment) fs-n1...

nullptr21:03:22

#_"this is a comment" fs-n1...

richiardiandrea21:03:22

ah right thanks! now I need to tweak emacs to show that as comment

richiardiandrea21:03:32

yes the second works

richiardiandrea21:03:11

except in aggressive-indent-mode but these are details I can rework

peeja21:03:55

I'm trying to understand how to use CommonJS modules with :foreign-libs

peeja21:03:21

I can't find much documentation, though

peeja21:03:31

Specifically, I'd like to try to use react-a11y: https://github.com/reactjs/react-a11y

peeja21:03:28

I'm installing it locally with npm, then I'm adding it to my foreign-libs:

peeja21:03:34

:foreign-libs [{:provides ["react-a11y"]
                :file "node_modules/react-a11y/dist/index.js"
                :module-type :commonjs}]}}

peeja21:03:44

Now I assume I want to require react-a11y, but then I'm not sure how to get at its exports object

peeja21:03:49

Also, on compile I get

maria21:03:50

@peeja Sorry, regarding the lack of documentation. Here is a small sample project I made a while ago: https://github.com/mneise/circle-color. You should be able to access the exports object in a similar way as accessing objects of a “normal” google closure module, e.g. react-a11y/foo.

peeja21:03:53

ERROR: JSC_ES6_MODULE_LOAD_ERROR. Failed to load module "object.assign" at node_modules/react-a11y/dist/index.js line 3 : 13
ERROR: JSC_ES6_MODULE_LOAD_ERROR. Failed to load module "./assertions" at node_modules/react-a11y/dist/index.js line 4 : 17
ERROR: JSC_ES6_MODULE_LOAD_ERROR. Failed to load module "./after" at node_modules/react-a11y/dist/index.js line 5 : 12

peeja21:03:01

So I must be doing something wrong simple_smile

peeja21:03:27

@maria: So, how do I access react-a11y itself?

peeja21:03:33

It's a function I want to call

peeja21:03:34

Ah, under js/?

maria22:03:54

@peeja Regarding the errors, if your module depends on other modules, you also need to include them in the build config.

peeja22:03:10

Ah, of course.

peeja22:03:24

Great, then I'm on the right track. Thanks, @maria!

maria22:03:31

@peeja There is also a little bit more information on this topic on my blog that I wrote during the gsoc project: http://mneise.github.io/archives.html 😉

peeja22:03:00

Oh, what do I have to do to include them in the build config so that require() finds them correctly?

peeja22:03:53

Here, index.js is having trouble finding ./assertions, but assertions.js is next to index.js

peeja22:03:24

Looks like this is working:

peeja22:03:27

[{:provides ["react-a11y"]
  :file "node_modules/react-a11y/dist/index.js"
  :module-type :commonjs}
 {:file "node_modules/react-a11y/dist/assertions.js"
  :module-type :commonjs}
 {:file "node_modules/react-a11y/dist/after.js"
  :module-type :commonjs}]

bhauman22:03:11

@ag shouldn't use rlwrap with lein repl, it has built in readline behaviour

ag22:03:08

@bhauman: on unrelated note: can you sir record a video and teach us how to use figweel with CIDER. Everything is so confusing. I was able to connect to cljs repl using awesome instructions from here: https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl but sending stuff into it doesn't seem to work as I thought it would… 😕

bhauman22:03:31

@ag it's true that's it's confusing and frustrating, but a video is a big ask and it's not going to be significantly different than the cider instructions I have on that page. Have you checked in with the guys on the #cider channel?

ag23:03:31

@bhauman: yeah I guess video wouldn’t be very relevant for very long - everything changing so fast