clojurescript

How can I create a basic ClojureScript Hello World app in Lighttable?

天大地大妈咪最大 提交于 2019-12-02 21:59:30
The documentation seems quite sparse in LightTable. I want to create a very bare bones ClojureScript web application in LightTable as a starting point to build on. I have the Instarepl in Clojure working fine, and then I create a new file called dummy.cljs containing the following: (ns dummy) (js/alert "Hello lighttable") How can I run this? Update I have figured this out now, and I will post a video on how todo it as it is quite visual. Update 2 Here is the video: http://www.youtube.com/watch?v=GZ6e0tKqYas you should first create a project via lein( https://github.com/technomancy/leiningen )

Which is faster, Clojure or ClojureScript (and why)?

我是研究僧i 提交于 2019-12-02 21:49:30
If I had to guess, I'm pretty sure the answer is Clojure, but I'm not sure why. Logically (to me) it seems like ClojureScript should be faster: Both are "dynamic", but ClojureScript Compiles to JavaScript, running on V8 V8 engine is arguably the fastest dynamic language engine there is V8 is written in C whereas Clojure: Is also dynamic Runs in JVM, which has no built-in dynamic support, so I'm thinking thus JVM has to do whatever V8 is doing too, to enable dynamic support and Java is slower than C So how could Clojure be faster than ClojureScript? Does "dynamic" mean something different when

Why aren't NodeList / HtmlCollection seqable?

落爺英雄遲暮 提交于 2019-12-02 20:41:13
As a newcomer to Clojurescript it appears to me that every Clojurescript project will have some snippet of code like this: (extend-type js/NodeList ISeqable (-seq [array] (array-seq array 0))) Why isn't this part of the core library? You have to think that clojurescript is a compiler to javascript as a language, not only browser JavaScript. You can also use it in other platforms like nodejs or with the QT library where NodeList does not exist (because it is part of the Dom api and not the standard language). If you are looking for a way to create a sequence from a NodeList there is array-seq

How to Debug ClojureScript

走远了吗. 提交于 2019-12-02 17:31:35
I apologize for this seemingly stupid question, but I've been playing with ClojureScript on and off for a few weeks now, and I can't figure out this one simple question: How do I debug ClojureScript? So here is the problem: I write my *.cjs files I run cljsc/build ... I load up my webpage. Something bad happens. I open up the firefox console. I get a line in the generated js, which I find incomprehensible, and I have no idea which line of the original cljs file it came from. My question: What is the right way to develop ClojureScript applications? PS I've looked at ClojureScriptOne -- what I

ClojureScript + React-Native - Embed Videos

筅森魡賤 提交于 2019-12-02 10:36:29
问题 I am new to ClojureScript. I would like to embed video (Youtube) to the hybrid mobile app using ClojureScript and React Native. I have tried to implement react-native-video and react-native-youtube plugins in ClojureScript for achieving this. But, both of these end with a crash. I don't know whether there is something wrong with referring to the library or not. Using react-native-video : (def Video (js/require "react-native-video")) (def video-view (r/adapt-react-class Video)) The component

ClojureScript + React-Native - Embed Videos

血红的双手。 提交于 2019-12-02 06:37:51
I am new to ClojureScript. I would like to embed video (Youtube) to the hybrid mobile app using ClojureScript and React Native. I have tried to implement react-native-video and react-native-youtube plugins in ClojureScript for achieving this. But, both of these end with a crash. I don't know whether there is something wrong with referring to the library or not. Using react-native-video : (def Video (js/require "react-native-video")) (def video-view (r/adapt-react-class Video)) The component reference is: [video-view {:style {:position "absolute" :top 0 :bottom 0 :left 0 :right 0} :source {:uri

How to analyze Closure Compiler bundle size

∥☆過路亽.° 提交于 2019-12-01 18:47:59
I have an app in ClojureScript, which uses Google's Closure Compiler as a compiler backend. The resulting bundle using advanced optimizations seems way too big for what it is. I blame the dependencies but how do I find out which modules are taking the most bytes in the output bundle? I scanned through all the Closure Compiler options and didn't find anything useful. Then I tried to learn about source maps and use that to calculate individual module size but with no success. I would like a tree-like output where I can dig in and find the biggest modules in terms of size, eg. [+] goog 100kb [+]

Clojure - walk with path

拈花ヽ惹草 提交于 2019-12-01 05:06:16
I am looking for a function similar to those in clojure.walk that have an inner function that takes as argument : not a key and a value, as is the case with the clojure.walk/walk function but the vector of keys necessary to access a value from the top-level data structure. recursively traverses all data Example : ;; not good since it takes `[k v]` as argument instead of `[path v]`, and is not recursive. user=> (clojure.walk/walk (fn [[k v]] [k (* 10 v)]) identity {:a 1 :b {:c 2}}) ;; {:a 10, :c 30, :b 20} ;; it should receive as arguments instead : [[:a] 1] [[:b :c] 2] Note: It should work

Clojure - walk with path

佐手、 提交于 2019-12-01 02:44:17
问题 I am looking for a function similar to those in clojure.walk that have an inner function that takes as argument : not a key and a value, as is the case with the clojure.walk/walk function but the vector of keys necessary to access a value from the top-level data structure. recursively traverses all data Example : ;; not good since it takes `[k v]` as argument instead of `[path v]`, and is not recursive. user=> (clojure.walk/walk (fn [[k v]] [k (* 10 v)]) identity {:a 1 :b {:c 2}}) ;; {:a 10,

Accessing “this” in Clojurescript

微笑、不失礼 提交于 2019-12-01 02:07:16
Is there a way to access the "this" object in clojurescript? I am having issues with event propagation when I wrap an icon with an anchor and try to attach a handlder to the anchor. Without access to "this" in the handler I am constantly dealing with the inner icon firing the event sometimes and the anchor firing other times. edit: As was suggested below, this-as is the way to do this. An example could be (defn my-handler [e] (this-as this (let [data-attr (.data ($ this) "my-attr")] (log data-attr)))) eagleflo Use ClojureScript's this-as macro: https://github.com/clojure/clojurescript/commit