Liking cljdoc? Tell your friends :D

hara.io.file.watch


*defaults*clj


*filewatchers*clj


add-io-watchclj

(add-io-watch obj k f opts)

registers the watch to a global list of filewatchers

registers the watch to a global list of *filewatchers*
raw docstring

event-kindsclj


event-lookupclj


event-typesclj


kind-lookupclj


list-io-watchclj

(list-io-watch obj _)

list all *filewatchers

list all *filewatchers
raw docstring

patternclj

(pattern s)

creates a regex pattern from the string representation

(pattern ".*") => #"\Q.\E.+"

(pattern "*.jar") => #".+\Q.\Ejar"

creates a regex pattern from the string representation

(pattern ".*") => #"\Q.\E.+"

(pattern "*.jar") => #".+\Q.\Ejar"
raw docstring

process-eventclj

(process-event watcher kind file)

helper function to process event

helper function to process event
raw docstring

register-entryclj

(register-entry service path)

adds a path to the watch service

(-> (.newWatchService (FileSystems/getDefault)) (register-entry "src"))

adds a path to the watch service

(-> (.newWatchService (FileSystems/getDefault))
    (register-entry "src"))
raw docstring

register-pathclj

(register-path {:keys [service] :as watcher} path)

registers either a file or a path to the watcher (-> (watcher [] {} {}) (assoc :service (.newWatchService (FileSystems/getDefault))) (register-path "test"))

registers either a file or a path to the watcher
(-> (watcher [] {} {})
    (assoc :service (.newWatchService (FileSystems/getDefault)))
   (register-path "test"))
raw docstring

register-sub-directoryclj

(register-sub-directory watcher dir-path)

registers a directory to an existing watcher

(-> (watcher ["src"] {} {}) (assoc :service (.newWatchService (FileSystems/getDefault))) (register-sub-directory "test"))

registers a directory to an existing watcher

(-> (watcher ["src"] {} {})
    (assoc :service (.newWatchService (FileSystems/getDefault)))
   (register-sub-directory "test"))
raw docstring

remove-io-watchclj

(remove-io-watch obj k _)

removes the watcher with the given key

removes the watcher with the given key
raw docstring

run-watcherclj

(run-watcher watcher)

initiates the watcher with the given callbacks

initiates the watcher with the given callbacks
raw docstring

start-watcherclj

(start-watcher watcher)

starts the watcher

starts the watcher
raw docstring

stop-watcherclj

(stop-watcher watcher)

stops the watcher

stops the watcher
raw docstring

watch-callbackclj

(watch-callback f root k)

helper function to create watch callback

helper function to create watch callback
raw docstring

watcherclj

(watcher paths callback options)

the watch interface provided for java.io.File

(def ^:dynamic happy (promise))

(watch/add (io/file ".") :save (fn [f k _ [cmd file]] (watch/remove f k) (.delete file) (deliver happy [cmd (.getName file)])) {:types #{:create :modify} :recursive false :filter [".hara"] :exclude [".git" "target"]})

(watch/list (io/file ".")) => (contains {:save fn?})

(spit "happy.hara" "hello")

@happy => [:create "happy.hara"]

(watch/list (io/file ".")) => {}

the watch interface provided for java.io.File

(def ^:dynamic *happy* (promise))

(watch/add (io/file ".") :save
           (fn [f k _ [cmd file]]
             (watch/remove f k)
             (.delete file)
             (deliver *happy* [cmd (.getName file)]))
           {:types #{:create :modify}
            :recursive false
            :filter  [".hara"]
            :exclude [".git" "target"]})

(watch/list (io/file "."))
=> (contains {:save fn?})

(spit "happy.hara" "hello")

@*happy*
=> [:create "happy.hara"]

(watch/list (io/file "."))
=> {}
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close