(add-handler manager handler)
(add-handler manager checker handler)
adds a handler to the manager (-> (add-handler (manager) :hello {:id :hello :handler identity}) (match-handlers {:hello "world"}) (count)) => 1
adds a handler to the manager (-> (add-handler (manager) :hello {:id :hello :handler identity}) (match-handlers {:hello "world"}) (count)) => 1
(check-data data chk)
checks to see if the data corresponds to a template
(check-data {:hello true} :hello) => true
(check-data {:hello true} {:hello true?}) => true
(check-data {:hello true} '_) => true
(check-data {:hello true} #{:hello}) => true
checks to see if the data corresponds to a template (check-data {:hello true} :hello) => true (check-data {:hello true} {:hello true?}) => true (check-data {:hello true} '_) => true (check-data {:hello true} #{:hello}) => true
(checker-form checker)
creates a checker form
(checker-form '_) => hara.common.primitives/T
(checker-form 'string?) => 'string?
creates a checker form (checker-form '_) => hara.common.primitives/T (checker-form 'string?) => 'string?
(expand-data data)
expands shorthand data into a map
(expand-data :hello) => {:hello true}
(expand-data [:hello {:world "foo"}]) => {:world "foo", :hello true}
expands shorthand data into a map (expand-data :hello) => {:hello true} (expand-data [:hello {:world "foo"}]) => {:world "foo", :hello true}
(handler-form bindings body)
creates a bindings form based on input
(handler-form '[name date] '(str name " " date)) => '(clojure.core/fn [{:keys [name date]}] str name " " date)
creates a bindings form based on input (handler-form '[name date] '(str name " " date)) => '(clojure.core/fn [{:keys [name date]}] str name " " date)
(list-handlers manager)
(list-handlers manager checker)
list handlers that are present for a given manager
(list-handlers (manager)) => []
list handlers that are present for a given manager (list-handlers (manager)) => []
(manager)
(manager id store options)
creates a new manager (manager) ;; => #hara.event.common.Manager{:id :b56eb2c9-8d21-4680-b3e1-0023ae685d2b, ;; :store [], :options {}}
creates a new manager (manager) ;; => #hara.event.common.Manager{:id :b56eb2c9-8d21-4680-b3e1-0023ae685d2b, ;; :store [], :options {}}
(match-handlers manager data)
match handlers for a given manager
(-> (add-handler (manager) :hello {:id :hello :handler identity}) (match-handlers {:hello "world"})) => (contains-in [{:id :hello :handler fn? :checker :hello}])
match handlers for a given manager (-> (add-handler (manager) :hello {:id :hello :handler identity}) (match-handlers {:hello "world"})) => (contains-in [{:id :hello :handler fn? :checker :hello}])
(new-id)
creates a random id with a keyword base (new-id) ;;=> :06679506-1f87-4be8-8cfb-c48f8579bc00
creates a random id with a keyword base (new-id) ;;=> :06679506-1f87-4be8-8cfb-c48f8579bc00
(remove-handler manager id)
adds a handler to the manager (-> (add-handler (manager) :hello {:id :hello :handler identity}) (remove-handler :hello) (match-handlers {:hello "world"})) => ()
adds a handler to the manager (-> (add-handler (manager) :hello {:id :hello :handler identity}) (remove-handler :hello) (match-handlers {:hello "world"})) => ()
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close