This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-27
Channels
- # adventofcode (3)
- # aws (1)
- # beginners (79)
- # boot-dev (1)
- # clara (50)
- # cljs-dev (7)
- # clojure (60)
- # clojure-austin (1)
- # clojure-germany (1)
- # clojure-greece (1)
- # clojure-russia (3)
- # clojure-spec (43)
- # clojure-uk (1)
- # clojurescript (76)
- # data-science (1)
- # datomic (26)
- # docs (2)
- # emacs (7)
- # fulcro (10)
- # hoplon (1)
- # instaparse (1)
- # lumo (3)
- # off-topic (16)
- # om (3)
- # onyx (2)
- # re-frame (3)
- # reagent (24)
- # ring-swagger (10)
- # shadow-cljs (15)
- # spacemacs (1)
- # sql (16)
- # uncomplicate (12)
- # unrepl (47)
Hello all, is there any way to use chart javascript/clojurescript from java without having browser?
I want to use http://canvasjs.com charting to generate report, but it has to run in schedule mode, so no browser
cljs pdf generation https://www.youtube.com/watch?v=X6rxaDtZMPg (don't recall the exact approach described in the vid... but it'll take you 5min to find out ;p)
I try to use re-frame together with reagent. In the initialization of the page I need to make two ajax calls. so, the initialization event has to return two :ajax effects - here is the code:
(reg-event-fx
:init-db
(fn [coef event]
{:backend-ajax {:method :get, :url "/rest/items",:on-success [:set-items] :on-failure [:comm-err]}
:backend-ajax {:method :get, :url "/rest/settings", :on-success [:set-settings] :on-failure [:comm-err]}}))
of course, I cannot put the same key twice, but how to return two effects of the same type with different parameters?@avivak
First, there's a re-frame channel which would be a better place for this question
Second, you might be interested in reviewing re-frame-http-fx
or perhaps (more powerful, but more complicated) re-frame-async-flow
Third, and now I really am getting around to answering your question, you, the writer of the effect :backend-ajax
, can allow for a vector of maps to be supplied if you want. You get to design the :backend-ajax
DSL any way you want, provided you then interpret it in your effect handler
(I'm assuming it is your effect
and not something from a library)
@johnjelinek you can see here - https://clojureverse.org/t/any-syntax-to-match-async-await-in-creating-web-servers/825
@mikethompson Thanks for your answer! 1. I'll move to re-frame channel. 2. just for your answer. the :backend-ajax was written by me. but I wanted to keep the implementation of the effect as simple as possible (handle just one request). I thought it might be supported by re-frame. the re-frame-async-flow handle actions flow, I need them to be executed in parallel.
@avivak re-frame-http-fx
handles multiple (via a list
or vector
of maps
)
@mikethompson thanks 🙂
Are there any tools for analyzing the output of Closure to see what dependency takes what space after optimization?
just asking because these kinds of tools exist for the webpack ecosystem i.e. https://github.com/webpack-contrib/webpack-bundle-analyzer
@macroz I built something recently. not much on the visual front but the table provides all the info you’d need. https://clojureverse.org/t/help-wanted-release-bundle-size-visualization/871/9?u=thheller
Looks cool! How does it work? Does it compile/zip each file separately or the whole bundle together?
it takes the optimized output file + source map and uses the source map to get fairly accurate sizes how many bytes belong to each individual source file
gzip is done for the overall file but not separately since that would not be accurate
I didn’t spend too much time on this yet. I only wanted to rough overview and something I can track over time.
found someone made this for the purpose https://github.com/stephanos/minifyretracer
this sort of worked but most of the code is in unmapped https://github.com/danvk/source-map-explorer
Hello everyone, is there a way to delete
the property of a JS Object in CLJS ? Or unset!
it ? In my tests I need to set the global error handler window.onerror
but I want to clean up after
I'm currently using (set! (.-onerror js/window) nil)
since it's null
by default, but I'm wondering if there's a better way
Thanks @macroz, didn't know it existed ! But I've just realized I don't really want to js-delete
window.onerror
, it should exist after my test. Not sure about the consequence of completely deleting it (messing with window
properties might introduce some weird bugs down the road)
deleting it means it'll be undefined
in the browser, whereas setting it to nil
means it's null
in the browser. May not be a problem...
messing with onerror
manually is a bad idea in a testing framework... (`Karma` through doo
)
hello everyone. happy commencement of post solstice gradual day lengthening. one of my rum :input#search-inputs changes the value of the atom :on-change with #(reset! ... ) and i'd like to also run another function at the same time as :on-change that runs a database query
is there a simple way to do this? put a watch on the atom and have thngs happen on watch? (have not done that yet)
@sova are you using reagent?
if not, add-watch is quite straightforward to use, but reagent has something called reactions that are designed for this sort of thing
@noisesmith using rum, which has > reactives
< rum/reactive but i'm not sure how it does what it do
my main question is, can i ttry to cram 2 function calls where 1 anonymous function fits nicely in my :on-change section
or does it make more sense and add more clarity to figure out how to make a separately exisiting atom watcha
can’t you make an anonymous function that does two things?
perhaps I am missing something obvious here
haha you definitely can, but i'm a newbie and question the obvious at every turn 😄
can one wrap multiple function calls with (do ) ... inside an anonymous call?
it seems like the simple thing is to just make a real anonymous function
#() is a shorthand for (fn []) and fn has an implicit do
so #( something % ) is the same as (fn [x] (something x)) ?
=> '#(+ % %2)
(fn* [p1__47179# p2__47180#] (+ p1__47179# p2__47180#))
substituting for weird names that expands to (fn [x y] (+ x y))
right
you're awesome
thanks for figuring out my question for me too haha
hey i have another questoin
while i have some clarity to phrase it right
i'm going to let people do the kind of search where results are instant
so i need to figure out a way to do it smarter than google, and locally cache results for every new word
typing in "hidden" to search you'd effectively be searching for:
h, hi, hid, hidd, hidde, hidden
later if you ask for "hid" you wouldn't need to send as detailed a list back [just changes/deltas/updates] ...
since it's still kinda brainstorming mode, do you have any thoughts on this fun puzzle?
there’s an example that dnolen put together for this, the short version is “debouncing”
wow really?! i am ecstatic to hear that stronger minds have already come across it xD
hmm debouncing
maybe I misunderstood your question actually… but usually debouncing is called for when using an API to back an auto-filled completion (sounds like maybe you need caching too)
Totally different question. Although that's a great idea, I actually want non bounced input
but i'll consider it more, maybe it makes no sense to cache hi and hid and hidd if all you want is hidden
this being clojure, that cache is very easy to create and manage - it can just be a hash-map with string keys in an atom
(as long as you don’t need something super fancy from it at least)
yeah i really don't need much fanciness. just some sort of append-only cache. although i am looking to datascript because the client-side db might get large enough quickly enough to warrant some more query flexibility