alright, you are on the right track. - javascript objects are built with js-obj so this part is absolutely correct: (def aCompletions (js-obj "getCompletions" getCompletions)) - you can call $.getJSON like (.getJSON js/jQuery args) in your case it is
(.getJSON js/jQuery "js/a.json" (fn [wordlist] (callback null (map #(js-obj "word" (.-word %) "value" (.-word %) "meta" "artemis") wordlist)))) - On Friday, November 4, 2016 at 9:35:45 PM UTC+3, zain...@gmail.com wrote: > > I am using ace editor.js in clojurescript using reagent. I am trying to > add custom autocomplete in the ace editor using following code in a js > based application > > var aCompleter = { > getCompletions: function(editor, session, pos, prefix, callback) { > if (prefix.length === 0) { callback(null, []); return } > $.getJSON( > "/js/a.json", > function(wordList) { > callback(null, wordList.map(function(ea) { > return {name: ea.word, value: ea.word, meta: > "artemis"} > })); > }) > } > } > > I need to port it to clojure script > > > Function > > (defn getCompletions > [editor session pos prefix callback] > (if (== prefix.length 0) > (callback nil []))) > > > function call > > (def aCompletions (js-obj "getCompletions" getCompletions)) > > > I am not able to figure out the > > $.getJSON( > "/js/a.json", > function(wordList) { > callback(null, wordList.map(function(ea) { > return {name: ea.word, value: ea.word, meta: > "artemis"} > })); > }) > > > -- You received this message because you are subscribed to the Google Groups "Reagent-Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to reagent-project+unsubscr...@googlegroups.com. To post to this group, send email to reagent-project@googlegroups.com. Visit this group at https://groups.google.com/group/reagent-project. For more options, visit https://groups.google.com/d/optout.