https://github.com/benjamingr/delta-differ
https://github.com/benjamingr/delta-differ
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/benjamingr/delta-differ
- Owner: benjamingr
- Created: 2020-02-29T13:39:19.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-24T01:31:04.000Z (over 2 years ago)
- Last Synced: 2025-02-13T16:47:42.647Z (5 months ago)
- Language: HTML
- Size: 2.02 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Differ
This package helps sending the HTML content of a page to a remote origin repeatedly.
It keeps internal state of the last HTMLs it saw and only sends the delta.```js
const differ = require('delta-differ');
const diffClient = new differ.DiffClient((ticket) => {
// this method can return a promise - presumably it would perform
// a remote call to another machine running the code - the
// other machine knows what the state is by the passed ticket parameter
// see the e2e tests for a full example
return differ.delta(ticket);
});
const pageHtml = diffClient.sync();
// some time later after html changes...
const newPageHtml = diffClient.sync();
```### Syncing other things
The delta function accepts a second "getHtml" argument that's useful for getting something other than the page body's html.
### Tests
Run the linter with `npm run lint`
Run unit tests with `npm run unit`
Run e2e tests with `npm run e2e`
Run the benchmarks with `npm run bench`