I'm trying to convert the following JavaScript function definition to ClojureScript to no avail:
chrome.webRequest.onBeforeRequest.addListener(
callback_function,
{urls: ["<all_urls>"]},
["blocking"]);
Here's the ClojureScript I'm using to try and replicate this:
(defn my-listener
[data]
(.log js/console data))
(defn web-request
[listener]
(.. js/chrome -webRequest -onBeforeRequest (addListener listener) (clj->js {"urls" ["<all_urls>"]}) (clj->js ["blocking"])))
(web-request my-listener)
It looks like the last 2 pieces to the function declaration aren't being generated properly (the {urls: ["<all_urls>"]}, ["blocking"]
bit). Here's what the compiler is outputting from the ClojureScript version:
example.core.my_listener = function example$core$my_listener(data) {
return console.log(data)
}
;
example.core.web_request = function example$core$web_request(listener) {
return chrome.webRequest.onBeforeRequest.addListener(listener).clj__GT_js(new cljs.core.PersistentArrayMap(null ,1,["urls", new cljs.core.PersistentVector(null ,1,5,cljs.core.PersistentVector.EMPTY_NODE,["\x3call_urls\x3e"],null )],null )).clj__GT_js(new cljs.core.PersistentVector(null ,1,5,cljs.core.PersistentVector.EMPTY_NODE,["blocking"],null ))
}
;
example.core.web_request.call(null , example.core.my_listener);
Any suggestions would be appreciated. Thanks!