This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-22
Channels
- # alda (1)
- # aws-lambda (23)
- # beginners (27)
- # boot (156)
- # business (2)
- # carry (4)
- # cider (1)
- # cljsjs (2)
- # cljsrn (29)
- # clojure (170)
- # clojure-austin (35)
- # clojure-czech (8)
- # clojure-dusseldorf (5)
- # clojure-italy (4)
- # clojure-nl (1)
- # clojure-quebec (2)
- # clojure-russia (45)
- # clojure-spec (49)
- # clojure-uk (12)
- # clojurescript (81)
- # component (5)
- # datomic (24)
- # devcards (26)
- # emacs (4)
- # hoplon (4)
- # jobs (1)
- # juxt (5)
- # leiningen (6)
- # luminus (14)
- # mount (26)
- # om (27)
- # om-next (2)
- # onyx (22)
- # pedestal (2)
- # planck (3)
- # proton (5)
- # re-frame (19)
- # reagent (2)
- # ring-swagger (60)
- # spacemacs (12)
- # specter (8)
- # untangled (119)
- # vim (61)
- # yada (36)
Hi, channel! Is there any good alternatives to secretary
lib (https://github.com/gf3/secretary#example-with-googhistory) in cljs?
@rmuslimov there's pushy which integrates with multiple routing libs: https://github.com/kibu-australia/pushy
But also making your own on top of goog.History
is reasonable. Take a look at pushy's implementation and you'll see it's actually not a lot of code
@rmuslimov https://github.com/funcool/bide https://github.com/DomKM/silk https://github.com/juxt/bidi (latter two don't include History integration)
@juhoteperi have you used bide?
@martinklepsch No, using bidi currently
I'm happily using bidi too
It's also my goto routing lib but the point in bide's readme that bidi routing specs are hard to read can't be denied
super basic - I'm trying to access object properties of html5 media elements like .-volume but I can't read/change them. Any ideas? thanks!
@martinklepsch challenge accepted: I find them easy to read
good for you 😂
The problem with bide, is that somewhere someone is parsing that string. I find that harder to trust than "parsing" a vector
@jcb you can do a github code search with what you’re asking about and filter by the cljs
extension
Thanks, I've had a look and the only project I found was one from 2013 with a backbone.js backend that was very confusing
change properties of an object with set!
: http://cljs.github.io/api/cljs.core/#setBANG
that's if you know how to do it in js, it's just a matter of translating line by line
cljs numbers are js numbers, your question should be answered by http://stackoverflow.com/questions/7223359/are-0-and-0-the-same
Hmm, running (/ 1 -0) on http://clojurescript.net/ returns Infinity instead of -Infinity. Is this a bug?
No, that is how JS works
Furthermore, http://Object.is(0, -0) returns false in JS, but (js/Object.is 0 -0) returns true on http://clojurescript.net
@domgetter you cannot use bootstrapped ClojureScript projects to determine actual behavior
I just started up a 1.9.229 repl, and it's the same behavior. Should I submit a bug report, or is this intended behavior?
@domgetter check compiled project, not repl
@domgetter a bug report is possible here but only after trying this in multiple engines
so sure file a JIRA minor ticket about the -0
literal - seems pretty newbie friendly too, so patch welcome
Awesome. Sorry if I didn't follow procedure. I'll look up documentation on cljs contribution.
how do I access functions like requestFullScreen? I thought that would be included in the closure lib? My editor and figwheel are unhappy
Why does this replace all characters in this string? (str/replace "a-b-c" #"[^\p{L}\p{Nd}]+" “”) ;;=> “"
that’s like "a-b-c".replace(/[^\p{L}\p{Nd}]+/,””)
in JS right? I tried it in clojure (JVM), but maybe they have different regex rules
@borkdude yes because JS regular expressions and Java regular expressions are two completely different things
@borkdude I couldn't get "asdf".replace(/\p{L}/, "") to work in JS. so I think your original is replacing all characters since everything is not any of the "meaningless" \p characters.
@domgetter thanks, I have reverted to this now:
(defn remove-non-word-chars [s]
(str/trim (str/replace s
#?(:clj #"[^\p{L}\p{Nd}]+"
:cljs #"[\W_]+") " ")))
why does this code:
(dom/img #js {:src image-url :style {:width "150px" :height "150px"}})
generate this invalid style attr:
style="cnt:2px;arr::width,150px,:height,150px;cljs$lang$protocol_mask$partition0$:16647951px;cljs$lang$protocol_mask$partition1$:8196px;”
? am i missing something here?I have been figuring out how the use a commonJS module (generated using webpack) inside of clojurescript - and this is what I have ended up with when calling an exported function named CreateWSConn:
(ns blah (:require [testlib]))
((.. js/testlib -CreateWSConn))
It works.. but I wondered if this is idiomatic?@jamesmintram if it can’t go through Google Closure - yes
I have included it in the foreign-libs section of project.clj:
:foreign-libs [{:file "resources/bundle.js"
:provides ["testlib"]
:module-type :commonjs}]
and the first line of the bundle.js in compiled/out is below. I don't know if that means it has gone through Google Closure?
goog.provide("module$resources$bundle");var exports$$module$resources$bundle=module$resources$bundle;
I guess a higher level question would be, I am not even sure what it would look like in the ideal case. Should I be able to call exported functions like this:
(.CreateWSConn js/testlib)
Awesome! It works. Thanks 🙂 I have struggled to find any definitive documentation or example showing how it all fits together, and the the significance of using the CommonJS support (at least all in one place) Are you aware of any such documentation? If not, it could be a good excuse for me to write an example or documentation of some kind.
the documentation should be clear that the functionality is in alpha state however and subject to change
Thanks!