Skip to content

Instantly share code, notes, and snippets.

@aarkerio
Last active December 20, 2019 21:19
Show Gist options
  • Save aarkerio/bb978c34c2f7b702530584293cf8db56 to your computer and use it in GitHub Desktop.
Save aarkerio/bb978c34c2f7b702530584293cf8db56 to your computer and use it in GitHub Desktop.
Calling ClojureScript from Hiccup
;; Clojure hiccup file
[:button {:class "btn btn-success" :onClick (str "zentaur.core.deletetest("id")")} "Borrar resgistro"]
;; file: src/cljs/zentaur/core.cljs
(defn ^:export deletetest [test-id]
(when (js/confirm (str "Delete test?"))
(set! js/window.location.href (str "/admin/tests/deletetest/" test-id))))
;; ^:export is necessary when the uberjar to production is made.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment