When you're calling functions of js-libs in clojurescript, you will face a lot of boilerplate transformations to native js-objects and/or arrays.
The calls that I make start to look like: (js-lib-fn (jayq.util/clj->js param1) (jayq.util/clj->js param2) (jayq.util/clj->js param3)) where the params are cljs-datatypes, and where I want the {} to be transformed into js-objects and the [] to become js-arrays. I thought I was clever when I came up with the following fn: (defn jsfn->clj [f] (fn [& params] (apply f (map jayq.util/clj->js params)))) (def cljs-js-lib-fn (jsfn->clj js-lib-fn) where "jsfn->clj" takes an exisiting js-fn and just calls the clj->js transformation function on the parameters. After that one-time assignment, you would simply use cljs-js-lib-fn… and life is good. This approach works a little bit, but seems to choke on those js-fn that rely on "this" for their implementation. I've attached an error-message. Is there a way to make this work? I'm aware of the "this-as" macro, but it's unclear to me how to use that one in the "jsfn->clj" function definition (?). Are there other approaches maybe that can ease the "too much boilerplate code" issue? Thanks, FrankS. Error message: #<core$prn clojure.core$prn@714005f6> "Error evaluating:" (ext-msg-alert "Hello" "Hoi There!!!") :as "cljs.user.ext_msg_alert.call(null,\"Hello\",\"Hoi There!!!\");\n" #<TypeError: Object function (title, message, fn, scope) { return this.show({ title : title, message : message, buttons : Ext.MessageBox.OK, promptConfig: false, fn : function() { if (fn) { fn.apply(scope, arguments); } }, scope: scope }); } has no method 'show'> TypeError: Object function (title, message, fn, scope) { return this.show({ title : title, message : message, buttons : Ext.MessageBox.OK, promptConfig: false, fn : function() { if (fn) { fn.apply(scope, arguments); } }, scope: scope }); } has no method 'show' at Function.Ext.define.alert (http://localhost:8080/js/sencha-touch/sencha-touch-all-debug.js:66782:21) at apply__2 (http://localhost:8080/js/main-debug.js:9185:16) at apply (http://localhost:8080/js/main-debug.js:9269:25) at cljs.core.pr_str.call.cljs.user.jsfn__GT_clj.G__7469__delegate (eval at <anonymous> (http://localhost:8080/js/main-debug.js:29682:147), <anonymous>:4:24) at cljs.core.pr_str.call.cljs.user.jsfn__GT_clj.G__7469 (eval at <anonymous> (http://localhost:8080/js/main-debug.js:29682:147), <anonymous>:11:26) at eval (eval at <anonymous> (http://localhost:8080/js/main-debug.js:29682:147), <anonymous>:1:89) at eval (eval at <anonymous> (http://localhost:8080/js/main-debug.js:29682:147), <anonymous>:6:3) at http://localhost:8080/js/main-debug.js:29682:142 at evaluate_javascript (http://localhost:8080/js/main-debug.js:29695:4) at Object.callback (http://localhost:8080/js/main-debug.js:29760:132) nil -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en