Skip to main content

watch

Jump to function (4)

watch/clear-on-reload#

(clear-on-reload namespace)

Removes every hook registered for namespace.

Example:

(clear-on-reload "my-app\core")

watch/register-on-reload#

(register-on-reload namespace name hook-fn)

Registers a zero-arg function to run every time namespace is reloaded by the watcher. Replaces any previously registered hook with the same name.

Example:

(register-on-reload "my-app\core" :refresh (fn [] (println "reloaded")))

watch/run-on-reload-hooks#

(run-on-reload-hooks namespace)

Executes every hook registered for namespace. Returns the number of hooks that fired.

Example:

(run-on-reload-hooks "my-app\core")

watch/watch!#

(watch! paths & [opts])

Starts the file watcher on the given vector of paths. Blocks until the watcher is stopped (e.g. Ctrl+C). Reloads changed namespaces in dependency order and runs any hooks registered with register-on-reload.

Example:

(watch! ["src/" "tests/"])