Fork me on GitHub
#clojurescript
<
2016-09-14
>
mfikes01:09:37

@tiensonqin Awesome! Thanks for sharing!!!

tiensonqin01:09:20

Thanks Mike, there are still some bad styles, also some works need to do with Android.

tiensonqin01:09:39

For now, about 85% code can be share between Ios and Android.

stbgz04:09:09

hey all what’s the appropiate way to block until a channel recieves input in cljs?

stbgz04:09:23

(let [r (go (alts! (make-request url))] ;make-request returns a channel with that will eventually have the response
(println (poll! r))

stbgz04:09:45

the above line does not seem to be working

danielcompton05:09:06

@stbgz you can use <! inside a go block to park the go block until a channel returns a value

symfrog09:09:28

I am using om.next to render a portion of a page. The page contains fragment links to other parts of the page, when the fragment links are clicked, the browser navigates correctly. However, when the back button is pressed after a fragment link was clicked, the browser does not navigate and only the address bar is updated. I have not imported or instantiated either goog.History or goog.history.Html5History. Has anyone experienced this issue and know how to get the default browser navigation behavior to occur when back is pressed after a jump using a fragment link?

symfrog10:09:53

Using the chrome debugger and putting a breakpoint on the hashchange event shows that the following closure function is invoked (although I still can't tell why the default browser navigation is not occurring): https://github.com/google/closure-library/blob/79c9a275b36636870e09f2874427849728eae474/closure/goog/events/events.js#L273

dnolen12:09:22

@symfrog have you checked the behavior in other browsers?

credulous14:09:35

Hi! After putting together a webapp manually, I’m starting to use luminus… but I’m confused about where the stylesheets are getting loaded from. In my browser I see <link href="/assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css”> and indeed I can load that file. But I can’t find bootstrap in my project directory anywhere.

credulous14:09:59

~/dev/cavalry-admin # tree | grep bootstrap
 ~/dev/cavalry-admin # tree | grep css
│   │   ├── css
│   │   │   └── screen.css
 ~/dev/cavalry-admin #

credulous14:09:18

This maybe should go in #beginners. 🙂

shaun-mahood15:09:31

@credulous: It looks like they are loaded using webjars - in the project.clj it requires [org.webjars/bootstrap "4.0.0-alpha.3"], and according to http://www.webjars.org/documentation you can reference boostrap as /assets/lib/bootstrap/css/bootstrap.css - hope that helps.

credulous15:09:37

Reading the docs… why do it when I can get helpful strangers to do it for me? (Reading more completely now.)

shaun-mahood15:09:57

I've read through docs and missed things like that, never hurts to ask. If it weren't for a combination of google and getting other people to google for me I think I'd be unemployed 🙂

symfrog15:09:44

@dnolen Yes, I checked in Safari (9.1.2), Firefox (48.0.2), Chrome (52.0.2743.116) and mobile Safari (iOS 9.3.2) . They all had the same behavior.

uwo16:09:00

I’m trying to figure out where to place an extern for a method in Pdfjs that’s on a prototype that I can’t seem to access from the top level. This is my first extern rodeo. Any advice?

dnolen16:09:47

@uwo try it even if it’s not technically available at the top level - it should work anyway

uwo16:09:03

interesting.

dnolen17:09:08

@symfrog to be honest, it doesn’t sound like something that browsers do w/o JS to help - but I could be wrong here

dnolen17:09:38

having built nav stuff before I don’t recall it ever working like that

symfrog19:09:24

@dnolen thanks, will keep digging for the cause

uwo20:09:00

@dnolen worked like a charm. thanks!

dnolen20:09:23

@uwo excellent, np

meta-meta21:09:13

what would one have to do to connect this browser terminal to a remote cljs figwheel repl? http://clojurescript.net/

darwin21:09:30

@meta-meta that is bootstrapped clojurescript, it does not make sense to connect it to a remote REPL (e.g. nREPL)

darwin21:09:44

or am I missing something?

meta-meta22:09:54

@darwin well, the terminal part is connected to the bootstrapped REPL, right? Is it possible to instead connect the terminal to nREPL? I'm still trying to wrap my head around it.

darwin22:09:13

nREPL uses TCP sockets, a web page can only talk over websockets, that is first huge problem, second, there is no implementation of nREPL client protocol in cljs, you would have to re-implement it, to wire it to UI component showing actual input box and terminal output is trivial compared to the previous two tasks

meta-meta22:09:03

Thanks @darwin that's helpful

darwin22:09:05

in general you could use kanaka’s websockify to mitigate the first problem: https://github.com/kanaka/websockify actually some past versions of his clojurescript REPL were not boostrapped but talked ot a server

darwin22:09:18

maybe look back in the project history

meta-meta22:09:19

Is the Figwheel REPL something that gets wrapped by nREPL?

darwin22:09:20

in dirac I took another approach, I didn’t write general TCP->websocket bridge, but specific nREPL proxy, just covering my needs: https://github.com/binaryage/dirac/blob/master/src/lib/dirac/lib/nrepl_tunnel.clj#L13

darwin22:09:18

this way Dirac REPL (in browser) can connect to Dirac Agent (proxy) which tunnels nREPL messages to a connected nREPL server

darwin22:09:58

wait there is another project for exposing nREPL protocol to websockets

darwin22:09:00

have to find it

meta-meta22:09:08

My end goal here is just to send messages to Figwheel, which already has a websockets connection to the page.

darwin22:09:06

this is how dirac was born

darwin22:09:47

AFAIK normal figwheel REPL is not an nREPL, is it just classic in-process REPL implementation

darwin22:09:15

but figwheel has another mode which can connect to an existing nREPL server or start it on your behalf and (optionally) connect to it

darwin22:09:18

what I did in that pull request, I simply hijacked input routine for figwheel’s REPL and automated typing into it (pasting there content incoming over websocket connection from browser)

meta-meta22:09:21

So did you get it working?

meta-meta22:09:18

Dirac does this, correct?

darwin22:09:29

does some of it

darwin22:09:45

I don’t need multiplexing reading in dirac

darwin22:09:06

there is no terminal window with stdin sitting elsewhere

darwin22:09:11

nrepl server is headless

darwin22:09:48

or to put it in better words, terminal connection has another nREPL session, it is independent

darwin22:09:12

but in that pull request I hijacked that interactive in-process figwheel REPL

darwin22:09:30

I didn’t want to touch nREPL, it sounded too complicated to dive into it

darwin22:09:20

another hard problem is intercepting all side-effecting output and presenting it to remote REPL as output

meta-meta22:09:21

Is it possible to embed the dirac devtool on a page or is that too intertwined with chrome?

darwin22:09:33

you would have to rebuild the UI from scratch, but the intercom/protocol stuff should be portable

meta-meta22:09:55

if I just want to send/receive messages? I don't need any fancy dev tools expand/collapse/sourcemap/etc

darwin22:09:04

yes, it might work, you just need one INPUT box and one DIV with printed content 🙂

darwin22:09:20

all the background parts are hard

meta-meta22:09:14

I believe it!

meta-meta22:09:19

I'll definitely install dirac either way

darwin22:09:19

what is your end goal? you could in theory run chrome devtools as a web app, hide everything except dirac and inject your UI there

darwin22:09:34

but you would need chrome instance on server with open debugging port

darwin22:09:41

which sounds dangerous 🙂

meta-meta22:09:31

I'm doing some work with A-Frame. It will only be dev for the foreseeable future so something dangerous is fine with me.

meta-meta22:09:51

Basically, code a VR scene in VR

meta-meta22:09:13

like Arcadia/Unity

darwin22:09:01

do you want random people to have REPL to your live server or what? if it is just for dev on a single machine, you could do with devtools+dirac

darwin22:09:10

dirac can connect to any nREPL server of your liking

meta-meta22:09:01

can the page talk to dirac devtools?

meta-meta22:09:30

I want a REPL panel rendered in the scene

darwin22:09:26

for can the answer is “yes”, for does the answer is “no"

darwin22:09:03

you have to have devtools open for dirac functionality to be available

meta-meta22:09:13

that seems like a simpler way to go to me

meta-meta22:09:35

that would be fine

darwin22:09:00

actually page talks to dirac indirectly, it tunnels its requests through console API: https://github.com/binaryage/dirac/blob/master/src/runtime/dirac/runtime/repl.cljs#L10

darwin22:09:18

it is a hack, but works pretty well

darwin22:09:03

FYI “runtime” code is installed in the page

meta-meta22:09:27

I'm hack friendly

meta-meta22:09:40

so something like console.log('~~$DIRAC-MSG$~~(+ 1 1)') should do the trick?

meta-meta22:09:21

or rather console.log('~~$DIRAC-MSG$~~', '(= 1 1)')

darwin22:09:22

right, I could introduce an “eval" method which would request evaluation by dirac

darwin22:09:44

we would tunnel it to devtools app via "$DIRAC-MSG$"

darwin22:09:22

also we could introduce hooks for various kinds of repl outputs so it can be redirected to you

meta-meta22:09:39

then what about going the other way?

darwin23:09:52

that is doable, go ahead and open an issue here: https://github.com/binaryage/dirac/issues

darwin23:09:53

but obviously, your people will still have to install dirac, configure it, open it and connect to some nREPL before having the service available in-page

meta-meta23:09:57

beautiful! that works for me

darwin23:09:11

I have maybe a crazy idea, you could in theory open dirac devtools in an iframe and embed that iframe into your VR scene (assuming iframes are supported) but let’s move our conversation into the dirac issue, we are spamming here at this point