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
+170-5
Original file line number
Diff line number
Diff line change
@@ -18,14 +18,179 @@ A library for developing offline-first web applications based on async data repl
18
18
-[ ] Method for initial sync and cleanup of bad entries
19
19
-[ ] Can we make it possible to sync to a file system, check: https://github.com/streetwriters/notesnook/tree/master/packages/streamable-fs
20
20
21
-
## Examples
21
+
# Examples
22
+
23
+
<details>
22
24
23
25
For usage take a look at the `src/examples` directory which has examples for:
24
26
25
-
1.`src/example/websocket-server` - A Node.js erver using an in-memory db and the websocket interfaces
26
-
2.`src/example/websocket-client-produce` - A Node.js client using the `WebsocketNodeJSConnector` that produces and replicates data from the server
27
-
3.`src/example/websocket-client-watch` - A Node.js client using the `WebsocketNodeJSConnector` that replicates data from the server
28
-
4.`src/example/browser` - Browser app using the `IndexedDBStore` and `WebsocketClientConnector`
27
+
1.`pnpm run example:server` - Example can be found in `src/example/websocket-server` - A Node.js erver using an in-memory db and the websocket interfaces
2.`pnpm run example:client-produce` - Example can be found in `src/example/websocket-client-produce` - A Node.js client using the `WebsocketNodeJSConnector` that produces and replicates data from the server
3.`pnpm run example:client-watch` - Example can be found in `src/example/websocket-client-watch` - A Node.js client using the `WebsocketNodeJSConnector` that replicates data from the server
4.`pnpm run example:client-browser` - Example can be found in `src/example/browser` - Browser app using the `IndexedDBStore` and `WebsocketClientConnector`
database.innerHTML=JSON.stringify({ version, store }, null, 2)
164
+
})
165
+
166
+
add.addEventListener("click", async () => {
167
+
connector.putOne({
168
+
version: awaitdb.getVersion(),
169
+
type: "user",
170
+
id: newDate().toString(),
171
+
name: input.value||"",
172
+
age: Date.now(),
173
+
})
174
+
175
+
input.value=""
176
+
})
177
+
178
+
dlt.addEventListener("click", async () => {
179
+
const data =awaitdb.getAll()
180
+
const first =awaitdata[0]
181
+
182
+
if (!first) {
183
+
return
184
+
}
185
+
186
+
awaitconnector.delete(first)
187
+
})
188
+
}
189
+
190
+
main()
191
+
```
192
+
193
+
</details>
29
194
30
195
> Running any client example requires the server to also be running, the relevant commands for running the examples can be found in the `package.json` file
Copy file name to clipboardexpand all lines: package.json
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "@sftsv/synk",
3
-
"version": "0.0.3",
3
+
"version": "0.0.5",
4
4
"description": "A library for developing offline-first web applications based on async data replication and synchronization between clients and the server",
0 commit comments