sanity icon indicating copy to clipboard operation
sanity copied to clipboard

Please export public API for javascript interop using ^:export

Open kristianmandrup opened this issue 9 years ago • 0 comments

I would love somehow to use Comportex or Sanity from Javascript more directly. Looking through the code base, I see it used in the examples via reagent/render:

(defn ^:export init
  []
  (reagent/render [main/sanity-app "Comportex" [model-tab] [world-pane]
                   all-features into-sim]
                  (dom/getElement "sanity-app"))
  (swap! main/viz-options assoc-in [:drawing :display-mode] :two-d)
  (put! into-sim ["run"]))

Would it make sense for main/sanity-app and such key API methods to be exported and made accessible from JS? or would it require a dedicated port to JS for React or similar reactive UI framework?

(defn ^:export sanity-app 
  [title model-tab world-pane features into-sim]
  (main/sanity-app title model-tab world-pane features into-sim))

kristianmandrup avatar Aug 10 '16 15:08 kristianmandrup