Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 application than a typical web page.

I'm hoping to use a higher-level language which can compile down to JS for the client-side logic, rather than programming directly in JS, and ClojureScript is my first choice.

I'm looking for a JS GUI library which can be used from within ClojureScript, and which supports a style of programming similar to "desktop" GUI libraries like Swing, QT, wxWidgets, and so on. It should allow me to create popup <div> "windows", put widgets such as buttons/labels/etc. in them, attach event handlers to the widgets, and so on. Do you know of one which would work?

like image 391
Alex D Avatar asked Oct 02 '12 12:10

Alex D


People also ask

Why use ClojureScript?

ClojureScript atoms are superior to JavaScript variables in the same way that JavaScript functions are superior to, say, Java methods: because they're first-class. They can be passed to functions, referenced by data structures, and abstractions can be built atop them. In addition, atoms can be observed.

What is GUI in JavaScript?

The GUI (widgets) is on the client side (HTML, JavaScript, …). • The GUI action triggers either a JavaScript function. call (on the client side), or pass a formatted C++ method to be called on the server side.

How does ClojureScript work?

ClojureScript is a compiler for Clojure that targets JavaScript. It emits JavaScript code which is compatible with the advanced compilation mode of the Google Closure optimizing compiler. It inherits most of the properties of Clojure, a dynamic programming language supporting interactive development.


1 Answers

Clojurescript is still young - I don't think there are mature frameworks of that caliber (yet?). Having said that, I'm building a UI using the following components:

  • Twitter Bootstrap + JQuery for visuals and UI elements
  • Chas Emerick's Friend for server-side authentication
  • Compojure + Ring + Jetty for the server
  • Crate (Clojurescript Hiccup) for html/dom generating
  • Jayq for JQuery wrapping
  • Fetch and/or Shoreleave's remotes for client-server RPC
  • Shoreleave's pubsub mechanism or Clojure's add-watch for data binding

A good feature of Clojure and Clojurescript are that they favour simple functions on generic data structures. That's why you tend to see several smaller libraries that do one specific job, but work really well together, as opposed to giant monolithic frameworks with an object model that requires you to adopt one way of thinking completely.

like image 132
Gert Avatar answered Sep 30 '22 00:09

Gert