https://github.com/controlroom/wire
Sane component communication
https://github.com/controlroom/wire
clojure wire
Last synced: 11 months ago
JSON representation
Sane component communication
- Host: GitHub
- URL: https://github.com/controlroom/wire
- Owner: controlroom
- License: epl-1.0
- Created: 2014-05-24T08:56:50.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2018-07-06T19:50:15.000Z (over 7 years ago)
- Last Synced: 2025-01-12T13:15:44.196Z (about 1 year ago)
- Topics: clojure, wire
- Language: Clojure
- Homepage:
- Size: 45.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**Wire** is a Clojure(Script) library for sanely managing component
communication
Wire is still a _proof of concept_ and is undergoing breaking changes.
## Simple usage
```clojure
(require '[wire.core :as w])
;; Create new wire and wire tap for a message. Any change functions
;; (tap, lay) are immutable and create a new wire.
(def basic-wire
(-> (w/wire)
(w/tap :hello
(fn [{:keys [msg user]}]
(println (str "hello " msg " from " (or user "nobody")))))))
;; Send message up the wire
(w/act basic-wire :hello {:msg "world"}) ;; => hello world from nobody
;; Create a new wire with extra data laid
(def richs-wire
(w/lay basic-wire nil {:user "rich"}))
;; Send message as you would, with extra laid context
(w/act richs-wire :hello {:msg "world"}) ;; => hello world from rich
;; The initial wire is untouched
(w/act basic-wire :hello {:msg "world"}) ;; => hello world from nobody
```
Wire pairs well with [Show](https://github.com/controlroom/show). Check out [wired-show](https://github.com/controlroom/wired-show) to see how you can easily use wire with dom objects.
## License
Copyright © 2018 controlroom.io
Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.