std.lib.signal
add-handler
added in 3.0
(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
check-data
added in 3.0
(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
expand-data
added in 3.0
(expand-data data)expands shorthand data into a map
(expand-data :hello) => {:hello true}
(expand-data :hello {:world “foo”}) => {:world “foo”, :hello true}
list-handlers
added in 3.0
(list-handlers manager)(list-handlers manager checker)list handlers that are present for a given manager
(list-handlers (manager)) => []
manager
added in 3.0
(manager)(manager id store options)creates a new manager (manager) ;; => #std.lib.signal.Manager{:id :b56eb2c9-8d21-4680-b3e1-0023ae685d2b, ;; :store [], :options {}}
match-handlers
added in 3.0
(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})
new-id
added in 3.0
(new-id)creates a random id with a keyword base (new-id) ;;=> :06679506-1f87-4be8-8cfb-c48f8579bc00
remove-handler
added in 3.0
(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”})) => ()
signal:with-temp
macro
added in 3.0
(signal:with-temp [checker handler] & body)uses a temporary signal manager for testing