This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-06
Channels
- # architecture (8)
- # aws (2)
- # beginners (156)
- # boot (163)
- # cider (22)
- # cljs-dev (2)
- # cljsrn (11)
- # clojars (6)
- # clojure (328)
- # clojure-austin (7)
- # clojure-dusseldorf (10)
- # clojure-italy (2)
- # clojure-russia (19)
- # clojure-spec (178)
- # clojure-uk (86)
- # clojurescript (81)
- # cursive (17)
- # datomic (33)
- # funcool (40)
- # hoplon (8)
- # jobs (5)
- # klipse (13)
- # leiningen (1)
- # luminus (21)
- # off-topic (140)
- # om (49)
- # om-next (4)
- # onyx (29)
- # planck (5)
- # protorepl (2)
- # re-frame (58)
- # reagent (2)
- # remote-jobs (4)
- # ring-swagger (16)
- # testing (1)
- # untangled (26)
- # yada (27)
cl.js is just a file with "alert("Loaded");" and the externs file is just blank. It is required in my code, but it isnt loading still
why does this work:
(def lg js/console.log)
(lg “Hello”) ; prints “Hello” to the js console
and this does not:
(def get-el js/document.getElementById)
(get-el “elementname”) ; results in TypeError: Illegal invocation
thank you @potetm -- I suppose after a long day I was subconsciously too lazy to do a google search lol
@joshjones 🙂 Glad I could help.
Can this difference in behavior be relied upon or is it an implementation detail that could change in the future?
#?(:cljs
(assert (identical? "ab" (str "a" "b")))
:clj
(assert (not (identical? "ab" (str "a" "b")))))
well, they're different for obvious reasons -- javascript really can't change its identity method, and clojure uses a StringBuilder
to concat (str "a" "b")
, and so it's highly unlikely (str "a" "b")
will ever be the same object as "ab"
in clojure. But it's not really something I'd want to rely on. -- why do you need to check for identical?
instead of simply =
? @jfntn
@joshjones: was looking at potential optimization for some string algorithms in our front end
hello guys, not sure if this is the right channel but i was wondering if anyone had example code that uses react-native-drawer with with reagent
@kim0 When running on Node, you don't use advanced compilation so you don't need externs from Cljsjs, and you might want to use npm packages directly
@kim0 Because there is no need to concatenate files for HTTP and because file size doesn't matter that much with Node apps (at least when running on server)
Does anyone have some pro tips on making library code “safe” in ClojureScript? For example: say I have a blob function like so:
(defn blob
"Converts a data-url into a JS Blob. This is useful for uploading
image data from JavaScript."
[data-url]
(-> (re-find #"^data:([^;]+);base64,(.*)$" data-url)
rest
decode
uint8
make-blob))
thanks for confirming @martinklepsch 🙂
So I wrote a thing I thought the people here might find useful: https://github.com/potetm/tire-iron
@potetm looks interesting
so it's a third alternative besides figwheel and boot-reload?
So those are the things that differentiate it. But at the end of the day yeah: It's a figwheel/boot-reload alternative.
i love that you built this potetm 🙂 curious: does figwheel do something that makes this approach unfeasible?
or is it possible for figwheel to meet all the same goals?
i’ve wondered about applying a true reload to cljs for a while
since it’s so good in jvm. but … the browser kinda comes with one already so i never bothered pursuing 🙂
I know figwheel's had a ticket out for namespace unloading for some time. But they're going to have a messaging problem, because a lot of their previous messaging was centered on the fact that you can safely store your state in a defonce
, which will no longer be the case.
aha. yes, that is a pretty major difference
Yeah, the refresh button + autobuild works alright. 🙂 Keeping your state around is nice, and having that turnaround be slightly faster is also nice.
how do you keep state around without defonce?
hmm. that actually seems inferior to defonce
At the end of the day, you either unload the namespace or you don't. There's nothing in clojurescript to indicate a var is defonce
d or not.
I'd agree that defonce
is easier. It's definitely less work for the user. But the tradeoff is var unloading.
In terms of being build-tool agnostic, I don't think that's a feasible goal for Figwheel. It's tied to Leiningen in a significant way. But @bhauman would obviously know more about that.
Does anyone know what's the entry point for react-virtualized (https://github.com/cljsjs/packages/tree/master/react-virtualized) in cljsjs?
window.ReactVirtualized does not exist
@pesterhazy is the file loaded for sure?
sicher ist nur der tod... but I added [cljsjs.react-virtualized]
to the requires...
@pesterhazy in :none
you should see it getting loaded in the “Sources” panel of your devtools
also: 😄
ahh cool didn't know that
is there, yes
!function(root, factory) {
"object" == typeof exports && "object" == typeof module ? module.exports = factory(require("React"), require("React.addons.shallowCompare"), require("ReactDOM")) : "function" == typeof define && define.amd ? define([ "React", "React.addons.shallowCompare", "ReactDOM" ], factory) : "object" == typeof exports ? exports.ReactVirtualized = factory(require("React"), require("React.addons.shallowCompare"), require("ReactDOM")) : root.ReactVirtualized = factory(root.React, root["React.addons.shallowCompare"], root.ReactDOM);
}(this, function(__WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_10__) {
that's the head of the file
Now we need someone who understands javascript exports 😄
Uncaught TypeError: Cannot read property 'shallowCompare' of undefined
<-- I think that's the issue
Is it possible to use Clojurescript to build a Javascript module that can be used with CommonJS?
Googling informs me there is lots of ways to use a CommonJS module with Clojurescript, but it’s hard to sift through to find the reverse direction?
Remember that ClojureScript will pass out immutable data structures unless you explicitly convert (with #js or similar), which may or may not be desirable depending on what you are writing
Is there a best practice for referencing minified versions of CSS files using Lein in a ClojureScript app? I am aware of lein-asset-minifier and it works great but what if I have multiple CSS files that I want to combine into a single minified one? In that case, I will continue to reference the individual CSS files while developing but reference the minified/combined version in my Production build. In the Javascript world I'm assuming you would use something like Gulp for this. Is there a standard way of handling this kind of a requirement via lein?
First: is the file actually there?
@captainlexington Sorry it was an embarrassing mistake which I just figured out. The asset path was wrong.
Anyone have any idea how to solve this error on re-natal init ProjectName
:
Command failed: node -e "require('react-native/local-cli/cli').init('.', 'ProjectName')"
@bhauman My apologies. I thought for some reason, you had to configure it with leiningen. Obviously not the case.
Other than that I like what you are doing with tire iron and I'm looking forward to reading it 🙂