This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-17
Channels
- # bangalore-clj (2)
- # beginners (202)
- # boot (18)
- # cljs-dev (8)
- # cljsjs (7)
- # cljsrn (4)
- # clojars (2)
- # clojure (401)
- # clojure-boston (2)
- # clojure-dusseldorf (1)
- # clojure-gamedev (36)
- # clojure-greece (2)
- # clojure-italy (1)
- # clojure-russia (16)
- # clojure-spec (27)
- # clojure-uk (7)
- # clojurescript (68)
- # core-async (16)
- # cursive (25)
- # datascript (1)
- # datomic (34)
- # funcool (1)
- # hoplon (1)
- # interop (1)
- # klipse (1)
- # leiningen (2)
- # lumo (75)
- # off-topic (17)
- # om-next (2)
- # onyx (66)
- # re-frame (18)
- # reagent (2)
- # ring-swagger (11)
- # spacemacs (1)
- # specter (1)
- # timbre (3)
- # untangled (48)
- # yada (7)
but I want one "cljs code base" to control both windows, without having to route stuff through the server
basically I want two windows, one for my SPA, another for pretty printing debug log info during dev time
You can only communicate between JS processes via message passing but IIRC there's a something along the lines of window.parent
if you open a child window...
browsers usually block pop-ups by default but if it's for development, you might be able to get away with spawning your SPA in the debug window and writing the the debug window using parent.querySelector('#log').value += 'log entry'
@akiroz: actually, by "write", I need to dump formatted DOM elements (like entire tables)
@akiroz: ah, in the "debug browser window" (not devtools), there is a div called "#log" then you select it ... hmmm intersting
@qqq check out the goog.debug
namespaces from the closure library, they do have this "debug window" you are looking for
@thheller that's interesting. I tried to get it to work on Klipse but didn't manage
How to include CSS files from CLJSJS?
Example: cljsjs/codemirror
has codemirror.min.css
file inside the jar, but I cant import this...
@pesterhazy https://google.github.io/closure-library/source/closure/goog/demos/debug.html
Hello, I'm new to cljs. I have an app, but when i want to build it with :optimizations :advanced
, i get the following error : >ERROR: JSC_MISSING_PROVIDE_ERROR. required "pages.calculator" namespace never provided
@mvrc: go to your cljs build output folder and search for goog.require('pages.calculator');
in generated files
there is probably some code where this is being called without prior goog.provide('pages.calculator')
which would offer such module
- a folder pages with all my pages (they all have the same error) and each page is in a subfolder for example calculator is in /pages/calculator/calculator.cljs
// Compiled by ClojureScript 1.8.51 {}
goog.provide('pages.calculator');
goog.require('cljs.core');
so for some reason this pages/calculator/calculator.js is not being included before your app/core.js
ok, so your filesystem names didn’t exactly match your namespace names and clojurescript got confused
cannot comment much on that, but I would guess clojurescript expects you to strictly follow the convention without extensive sanity checks, it works in :none
mode just by coincidence
I bet https://github.com/binaryage/cljs-oops would ahve solved this problem
he simply didn’t follow naming conventions for namespaces, the behaviour of his compilation output was undefined
Instead of posting in the specific channel like #rum or #reagent, I figured this would be the best place for an objective answer, what’s the reason for things like re-frame? Why doesn’t async.core + atoms suffice?
@benny for me the value of re-frame is in their docs/idea, the implementation is nice-to-have, but I would encourage everyone to implement their own
it is not that hard and you then understand full-stack of your app, re-frame is important piece at hart which you should not be afraid to touch / deep debug - but it depends on app of course
fair enough, thanks @darwin, I assumed there was no real “restriction” on not using one, but the best practices, “already done for you” piece makes sense
mainly wanted to make sure it’s worth it for me to go deeper before I do as I seem to be getting beyond the “surface” and it will just require more learning effort on my part
you are right, there is definitely great value in that quite many people are already familiar with re-frame, so if you use it, you make it easy for them to understand/touch your code
btw. I believe re-frame can be implemented in less than 200 LOC, at least the original concept of v0.5: https://github.com/binaryage/pure-frame/blob/master/src/re_frame/frame.cljs
here is how would you implement the event loop on using core.async: https://github.com/binaryage/pure-frame/blob/master/src/re_frame/v041_router.cljs#L46
@qqq if you don't mind only having only firefox and chrome compatibility, I believe you can talk between windows using js/BroadcastChannel as well.
so i am looking at writing cljs wrappers for openseadragon. but i am really at step zero: what does it mean to write cljs wrappers for a JS library that has mutable state? what are the design goals, and what are some easy-to-reason-about examples?
@benny
> what’s the reason for things like re-frame? Why doesn’t async.core + atoms suffice?
re-frame used to use core.async
and it still usese ratoms. So you could obviously just use them and build out an alternative solution to re-frame yourself. But then again you could equally ask, why would you even use core.async
, you have macros
and goog.nexttick
, so just build that yourself too. Same with Reagent itself ... why use it? ... just use React and clojurescript. Ultimately, re-frame gives you a leg up around architecture and specifically state managment. If you use it, you won't spend months making lots of subtle design decisions and getting some of them wrong etc. -- even at a pragmatic level there's a reason re-frame stopped using core.async
.. you probably don't want to be bothered bumping into problems already solved by someone else. But, having said that, re-frame is about 600 or so lines of code these days. So it is fairly simple.
Very true @mikethompson and after investing most of my day digging deeper into re-frame in particular the thought and documentation that comes with it is well worth it