You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-10Lines changed: 12 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# DOM Diffing and Synchronization over Braid-HTTP
2
2
3
-
Efficiently diff and synchronization a DOM, either locally or over the network via [Braid-HTTP](https://datatracker.ietf.org/doc/html/draft-toomim-httpbis-braid-http). Sync multiple browser & server DOMs over the network, via Dom Diffs. Collaboratively edit live HTML. Create mashups of UIs, interoperating via Dom Diffs.
3
+
Efficiently diff and synchronize a DOM, either locally or over the network via [Braid-HTTP](https://datatracker.ietf.org/doc/html/draft-toomim-httpbis-braid-http). Sync multiple browser & server DOMs over the network, via Dom Diffs. Collaboratively edit live HTML. Create mashups of UIs, interoperating via Dom Diffs.
The first thing `serve_dom_diff`does is subscribe to an underlying textual resource using the suplied callback with the `subscribe` function. Then, it responds to the request with a braid subscription using the `simpleton` merge type for html, which consists of sending replacement html for a given `xpath`. Whenever changes are made to the underlying textual resource, `serve_dom_diff`will figure out the relevant changes to the DOM, and send these patches to all subscribed clients.
37
+
`serve_dom_diff`first subscribes to an underlying textual resource using the provided callback. It then responds to the request with a Braid subscription using the `simpleton` merge type for HTML, which sends replacement HTML for a given `xpath`. When changes occur in the underlying textual resource, `serve_dom_diff`calculates the relevant DOM changes and sends these patches to all subscribed clients.
-`options`: <smallstyle="color:lightgrey">[optional]</small> An object containing additional options:
46
-
-`key`: <smallstyle="color:lightgrey">[optional]</small> ID of HTML resource to sync with. Defaults to `req.url`.
44
+
-`braid_text_cb`: Function called by `serve_dom_diff` to subscribe to the underlying textual resource. It receives a callback function with parameters like `({ version, parents, body, patches })` to be called for each new Braid version.
45
+
-`options`: (optional) An object containing additional options:
46
+
-`key`: (optional) ID of HTML resource to sync with. Defaults to `req.url`.
47
47
- This method handles Braid-HTTP requests for collaborative DOM editing.
48
48
49
49
## Client-side Usage
@@ -58,7 +58,7 @@ let dd = create_dom_diff(initialHtml)
0 commit comments