(get-lib-version lib-name callback)
Queries Clojars for the version of the given library, providing it in a
callback. If it can't find it, the callback receives an error object.
Example
(get-lib-version "dynadoc" callback)
Source
(defn
get-lib-version
"Queries Clojars for the version of the given library, providing it in a\n callback. If it can't find it, the callback receives an error object."
[lib-name callback]
(.send
XhrIo
(str "https://clojars.org/api/artifacts/" lib-name)
(fn
[e]
(callback
(or
(when
(.isSuccess (.-target e))
(->
e
.-target
.getResponseText
js/JSON.parse
(gobj/get "latest_release")))
(js/Error. (str "Can't find version for: " lib-name)))))
"GET"))