Skip to content

Commit

Permalink
Add more functions to cljs.storm.api
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmonettas committed Nov 8, 2023
1 parent 9917d7b commit 11c2815
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions src/main/clojure/cljs/storm/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,56 @@
(:require [cljs.storm.emitter :as emitter]
[cljs.storm.utils :as storm-utils]))

(defn add-instr-prefix
(defn add-instr-only-prefix

"Add instrumentation `prefix`.
When `touch-path` is provided, touches all the cljs and cljc files recusively.
Useful for making watchers like the shadow-cljs one recompile and reload files."

([prefix] (add-instr-prefix prefix nil))
([prefix] (add-instr-only-prefix prefix nil))
([prefix touch-path]
(emitter/add-instrumentation-only-prefix prefix)
(when touch-path
(storm-utils/touch-cljs-files touch-path))))

(defn rm-instr-prefix
(defn rm-instr-only-prefix

"Remove instrumentation `prefix`.
When `touch-path` is provided, touches all the cljs and cljc files recusively.
Useful for making watchers like the shadow-cljs one recompile and reload files."

([prefix] (rm-instr-prefix prefix nil))
([prefix] (rm-instr-only-prefix prefix nil))
([prefix touch-path]
(emitter/remove-instrumentation-only-prefix prefix)
(when touch-path
(storm-utils/touch-cljs-files touch-path))))

(defn add-instr-skip-prefix

"Add instrumentation `prefix`.
When `touch-path` is provided, touches all the cljs and cljc files recusively.
Useful for making watchers like the shadow-cljs one recompile and reload files."

([prefix] (add-instr-skip-prefix prefix nil))
([prefix touch-path]
(emitter/add-instrumentation-skip-prefix prefix)
(when touch-path
(storm-utils/touch-cljs-files touch-path))))

(defn rm-instr-skip-prefix

"Remove instrumentation `prefix`.
When `touch-path` is provided, touches all the cljs and cljc files recusively.
Useful for making watchers like the shadow-cljs one recompile and reload files."

([prefix] (rm-instr-skip-prefix prefix nil))
([prefix touch-path]
(emitter/remove-instrumentation-skip-prefix prefix)
(when touch-path
(storm-utils/touch-cljs-files touch-path))))

(defn get-instr-prefixes []
emitter/instrument-only-prefixes)

(defn set-instrumentation [on?]
(emitter/set-instrumentation on?))

0 comments on commit 11c2815

Please sign in to comment.