Fork me on GitHub
#cljs-dev
<
2015-08-02
>
martinklepsch17:08:36

@dnolen: uncompiled defines only work when the define is done with goog/define

martinklepsch17:08:16

@dnolen: I’ll open a ticket in a bit and put in what I’ve learned

martinklepsch18:08:03

@dnolen: http://dev.clojure.org/jira/browse/CLJS-1389 — is there an edit button for the description in JIRA?

martinklepsch20:08:43

Experimenting with a macro but somehow the compiled JS ends up containing hello_world.core.js_STAR_.call instead of what the compiler would usually emit.

(defmacro define
  [sym default]
  (let [defname (-> (str *ns* "." (name (symbol sym)))
                    (clojure.string/replace "-" "_"))
        goog-define (str "/** @define {boolean} */"
                         "goog.define('" defname "', " default")")]
    `(do
       (declare ~(symbol sym))
       (js* ~goog-define))))

martinklepsch20:08:34

I literally didn’t write any macros before I think 👻

kamn22:08:56

I was looking though the open backlog and ran into http://dev.clojure.org/jira/browse/CLJS-338 which seems like it should be closed? Does not seem to be an issue anymore