https://github.com/green-coder/embassy
[WIP] A Clojure(script) library to represent HTML diffs, to compose them together and to apply them on the DOM.
https://github.com/green-coder/embassy
clojure dom-manipulation wip-do-not-use
Last synced: 8 months ago
JSON representation
[WIP] A Clojure(script) library to represent HTML diffs, to compose them together and to apply them on the DOM.
- Host: GitHub
- URL: https://github.com/green-coder/embassy
- Owner: green-coder
- Created: 2021-07-26T06:45:02.000Z (over 4 years ago)
- Default Branch: made-in-taiwan
- Last Pushed: 2021-10-17T16:32:10.000Z (about 4 years ago)
- Last Synced: 2025-02-28T06:30:32.599Z (8 months ago)
- Topics: clojure, dom-manipulation, wip-do-not-use
- Language: Clojure
- Homepage:
- Size: 92.8 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Embassy
### API
`embassy.vdom.core/apply-vdom` is the main function of the library, it applies a `vdom-diff`
data structure (simply called `vdom` throughout the source code) to a `dom-element`.
A `vdom-diff` is created using the helper functions in the namespace `embassy.vdom.helper`.
See the namespace [embassy.vdom.helper-test](test/embassy/vdom/helper_test.cljc) for examples on how to use them.
`embassy.vdom.core/comp` is the second most important function of the library, it returns
a composition of 2 `vdom-diff` data structures.
### Use cases
This library can be used for updating the dom in a browser from a remote location,
in an incremental way. For example, by sending the updates from a server connected
to the browser via a websocket.
## The demo application
Compile the source code via Shadow-CLJS:
```shell
npm install
npx shadow-cljs watch :app
```
Then browse the page at [http://localhost:3000/](http://localhost:3000/)
## Running the tests while developing
```shell
./bin/kaocha --watch
```