6
votes
1answer
100 views

Why does using nth in clojurescript increase my codesize by 74026%

I have been comparing the generated javascript outputed by various calls in clojurescript and it feels like stepping on landmines. Some generate extremely readable (even in minified advanced mode) ...
0
votes
1answer
64 views

Clojure to JavaScript Converter (Leiningen)

I have Leiningen installed and the project all set up. Someone told me to use the "lein cljsbuild once" command to convert Clojure to JavaScript. This did not fully answer my question because I'm ...
1
vote
2answers
54 views

Export deftype methods

I am trying to create object in javascript and call a method. Method name is munged. I tried to use externs.js without luck. (deftype ^:export SceneMain [] Object (handleShow [_] ...
0
votes
1answer
65 views

Clojure to JavaScript [closed]

I got a problem with Clojure. I don't program in Clojure or ClojureScript, but I need some Clojure to compile to JavaScript. I followed the Getting Started ...
1
vote
1answer
39 views

Assistance translating JS to CLJS

I have developed a simple metronome in JS as a JS exercise and also out of need. It can be found here: https://github.com/Greduan/js-metronome/blob/master/js/main.js I have translated it to a certain ...
4
votes
1answer
101 views

Calling JavaScript object property as a constructor from ClojureScript

I am using a JavaScript library that exposes a constructor as a property of a global object. In JavaScript, I can call the constructor like this. var thing = new Library.Thing(); How do I call the ...
1
vote
1answer
182 views

Very basic syntax highlighter [closed]

I am looking to make a very basic sytax highlighter. I am looking to get pointed in the right direction. I know there are lots of great projects that do this already (Codemirror, rainbow.js, etc) but ...
1
vote
1answer
99 views

Invoking custom javascript functions in clojurescript

My project.clj is as follows : (defproject cljsbuild-example-simple "0.3.2" :description "A simple example of how to use lein-cljsbuild" :source-paths ["src-clj"] :dependencies ...
3
votes
2answers
119 views

Is it possible to insert and run a dynamic script tag?

I have the following code in a cljs file: (def template "<script type=\"text/javascript\"> console.log(\"The script was run\"); </script>") (defn add-script [] (let [s ...
1
vote
1answer
159 views

Matching false (== undefined, null) in ClojureScript core.match

I'm trying to match a false value of map's key, which in javascript effectively means also undefined, null etc... It seems to me that core.match matches the value exactly. Is there any way to do this? ...
3
votes
1answer
145 views

How does the ClojureScript compiler transform cljs to Javascript

I am having a little difficulty seeing how this is done. How is it able to convert it to JS without writing any JS (everything is in Clojure or CS). Can someone give a simple example of how the ...
3
votes
1answer
162 views

Using plain .js files (Google Closure'd) in ClojureScript build with lein-cljsbuild

I want to use some plain .js files in my ClojureScript project. I'm building it using lein-cljsbuild and the .js files are standard Google Closure namespaces with proper goog.provide declarations. So ...
2
votes
1answer
590 views

ClojureScript Hash Map performance vs. Javascript Objects

I am working with big JSON files (that basically contain tree-like structures) in a ClojureScript app. Basically I iterate over all elements in that tree structure and these are quite a bunch of ...
1
vote
3answers
148 views

Extending the constructor of a deftype in clojurescript

When creating a type via deftype in clojurescript: (deftype SomeObject [a b c] Object (update [_] (set! (.-a _) 5) (set! (.-b _) 6) )) Is there a possibility to ...
1
vote
1answer
80 views

IE9 does not accept unicode string in Javascript

I tried to run my webapp with IE 9 (it already runs well in Firefox and Chrome) and I continuously get The error Script1014: Invalid Character The debugger yields one line of code that contains ...
2
votes
1answer
580 views

Writing in Meteor using ClojureScript

Is there currently a solution for integrating ClojureScript with Meteor? I want to build a Meteor application and between the flavors of JavaScript (JavaScript, CoffeeScript, TypeScript, LiveScript ...
4
votes
2answers
237 views

How do I approach a javascript/clojurescript wrapper library for an api?

I'm primarily a Python developer, but I've been trying to learn Clojure/ClojureScript lately. As practice, I want to write a ClojureScript wrapper for Reddit's API. Most of my confusion is due to ...
4
votes
1answer
393 views

Accessing “this” in Clojurescript

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 ...
0
votes
1answer
89 views

In jQuery, how do i pass an event to a parent anchor if needed?

I am in clojurescript using jQuery but the answer should be the same for cljs and js I think. I have a helper function which creates creates an anchor element then puts an icon element inside of it. ...
1
vote
0answers
132 views

Integration clojurescript into a javascript framework

I would like to use Clojurescript to write a component within a Javascript framework but I can't work out how to create the constructor and call global variables within the object. The framework ...
2
votes
1answer
212 views

How to define a clojurescript function in the javascript global namespace at compile time?

I'm looking for a way to define Clojurescript functions in the Javascript global namespace at compile time. What I mean by compile-time is that I want the Clojurescript compiler to output this: ...
0
votes
0answers
128 views

Pre-fetching an image in the browser for HTML5/Canvas

I use clojurescript for some HTML5-Canvas website just for fun. Basically I do load images like this (let [image (js/Image. )] (set! (.-src image) url)) .... (this correspondents to ...
1
vote
1answer
41 views

Is the Google API client for javascript compatible with the Closure advanced mode compilation?

Mostly, the title says it all, but I could not find any answer in the documentation of the library. Specifically, can I use said library from Clojurescript ? Cheers
0
votes
2answers
192 views

Accessing clojurescript from html

I'm using catnip/leiningen in an attempt to learn Clojure... So I have a simple website and now I'd like to add a clojure-script in my page. So I took a simple example but now got stuck on how to ...
4
votes
2answers
685 views

Getting “cannot set property Error of undefined” when trying to run the .js output of a simple hello world clojurescript

I'm compiling: (ns example.hello) (js/console.log "Hello from ClojureScript!") With this configuration: (defproject lein-cljsbuild-example "1.2.3" :plugins [[lein-cljsbuild "0.2.9"]] ...
0
votes
2answers
139 views

JavaScript, Chrome, Textbox, Space, Backspace

I'm writing code in JavaScript, targeting Chrome. Now, consider what happens when: I press Space/Backspace on a webpage vs I press Space/Backspace on a textbox BY using (goog.events.listen ...
8
votes
3answers
1k views

JavaScript GUI library which is usable from ClojureScript?

On one of my ongoing web development projects, we need to create a page (really a mini-application of its own) which will have an interactive, "Web 2.0" interface, more like a graphical desktop ...
0
votes
1answer
543 views

Javascript to ClojureScript Conversion

I am trying to convert the following line to Cljs, var watchID = navigator.geolocation.watchPosition(onSuccess, onError, { enableHighAccuracy: true }); What would be the corresponding map for, { ...
0
votes
2answers
303 views

how to use a complex return object from clojurescript in javascript

I want to write a clojurescript function that returns a complex item like ["foo" "bar"] or (list "foo" "bar") and I want to be able to call this function from javascript and get at the parts of the ...
2
votes
3answers
224 views

F# / Clojure to Javascript: interaction with environment and javascript libraries

I've been looking at (mostly) functional languages that can convert to Javascript, and these two stand up top nowadays. But I have two doubts about them, (talking about ClojureScript and Pit for F#): ...
4
votes
2answers
853 views

Clojurescript, JavaScript, SVG, Charts, Graphics

I'm writing a client side app. I want to use ClojureScript. I would like to generate vector graphics (graphics, charts, line graphs). What should I read up on? [The only hard requirement is ...
5
votes
4answers
2k views

Idiomatically accessing json objects with clojurescript

Anyone have any docs for idiomatic clojurescript for access a javascript object (returned as json, essentially a hash)? I have a JSON object returned via an AJAX request: { list: [1,2,3,4,5], ...
2
votes
1answer
318 views

Has anyone a case implementation for clojurescript?

I need an implementation of the case macro. The original clojure implementation can't be used since it is kind of using the Java case statement internally. ...
6
votes
2answers
1k views

How do I create an JS Object with methods and constructor in ClojureScript

Imagine the task is to create some utility lib in clojurescript so it can be used from JS. For example, let's say I want to produce an equivalent of: var Foo = function(a, b, c){ this.a = ...
10
votes
1answer
1k views

Javascript interop assignment in Clojurescript

Dumb question: how do I do Javascript assignment in Clojurescript ? I'm using a Javascript lib and need to set the value of an object's field like obj.this=that; - I don't know Javascript so maybe ...
8
votes
1answer
199 views

Javascript as debuggable bytecode

There is a rise in languages that output javascript, such as CoffeeScript and ClojureScript. Since javascript will not be going away anytime soon, I presume this pattern of development will continue. ...
9
votes
2answers
673 views

How do I add my own JavaScript libs to ClojureScript?

I want to write a Google Chrome extension, using ClojureScript. With ClojureScript I can use all the Google Closure libs, but afaik access to the Chrome browser is not included in those libs. So I ...
7
votes
2answers
547 views

What is the most normal way to deliver a ClojureScript desktop application

I have a desktop application written in Clojure that suffers greatly from JVM startup time and is a really good fit for ClojureScript. It is delivered as a jar file for the JVM, what is the equivalent ...