You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I implemented CORS support in a fork so that the compiler can be used from AJAX clients on other hosts (see this example). If you want you can just diff my fork and pick up the CORS stuff, but I also did some other small stuff so I would need to clean it up if you want me to send a proper pull request. My fork is running here.
File compile as a service
What is the best way to add a http://host/compile-file API to compile a whole file of s-expressions instead of just one expression? I'm currently trying to integrate with JSBin. I have a working demo in a JSBin fork, but it just takes one expression in the file like the REPL.
What is the best workaround given the current compilation scheme, that is, compile a file, which is basically just a list of expressions, as one expression? I figured it works fine wrapped in a let expression. For example the following runs in my JSBin fork:
(let []
(ns cljs.user)
(def paper (js/Raphael. 10, 50, 320, 200))
(defn makeCircle
[x]
(let
[circle (.circle paper x x 10)]
(.attr circle "fill" "#0000ff")
(.attr circle "stroke" "#ffffff")
circle))
(def circles (map makeCircle (range 10 100 10)))
(doall circles)
(js/console.log (str circles))
)
Error handling
How can I get better error messages from the compiler to report to JSBin? How can I catch exceptions that occur with the reader in clj-params? I suppose I should disable it and explicitly call read-string on expr.
The text was updated successfully, but these errors were encountered:
CORS support
I implemented CORS support in a fork so that the compiler can be used from AJAX clients on other hosts (see this example). If you want you can just diff my fork and pick up the CORS stuff, but I also did some other small stuff so I would need to clean it up if you want me to send a proper pull request. My fork is running here.
File compile as a service
What is the best way to add a http://host/compile-file API to compile a whole file of s-expressions instead of just one expression? I'm currently trying to integrate with JSBin. I have a working demo in a JSBin fork, but it just takes one expression in the file like the REPL.
What is the best workaround given the current compilation scheme, that is, compile a file, which is basically just a list of expressions, as one expression? I figured it works fine wrapped in a let expression. For example the following runs in my JSBin fork:
Error handling
How can I get better error messages from the compiler to report to JSBin? How can I catch exceptions that occur with the reader in clj-params? I suppose I should disable it and explicitly call read-string on expr.
The text was updated successfully, but these errors were encountered: