Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

In bootstrapped ClojureScript cljs.js/eval-fn receives javascript source and evaluates it, returning a result. In some contexts it is necessary to evaluate the js asynchronously, can we add this functionality?

4 Answers

0 votes
by

Comment made by: dnolen

This ticket needs more rationale. Can you elaborate on the usecase?

0 votes
by

Comment made by: whamtet

My usecase is an asynchronous eval function

`
(fn eval-fn
[{:keys [source]}]
(js/chrome.devtools.inspectedWindow.eval source

(fn [result err]
  (if result
    (callback result)
    (callback err))))

`

There must be other people who have situations like this.

0 votes
by

Comment made by: dnolen

Interesting. I don't think this is a common use case, most JS engines provide synchronous eval. Not interested in any breaking changes but would be happy to take a patch that gives you the behavior you want via an option flag, {{:async-eval}}.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJS-1421 (reported by alex+import)
...